🌐 English

    Checking OFFS#

    The fsck.offs tool is used to check the OFFS file system.

    Usage of fsck.offs#

    The format of the fsck.offs command is as follows:

    fsck.offs [-anxdze] [-i <1|2>] <disk path>
    
    • The -a option automatically repairs problems if they are found. Versions prior to 3.9.x only report problems.
    • The -n option does not repair automatically.
    • The -x option does not unmount before checking. This is useful when other applications are using OFFS. It is used together with the -n option to obtain check results.
    • The -d option prints verbose logs.
    • The -i option is required when recovering corrupted AVI files. It specifies the user data storage method used at the time of recording.
      • A value of 1 represents a method where user data is stored in the STRD chunk of the video track header.
      • A value of 2 represents a method where only the location and size information of the user data are stored in the STRD chunk, and the actual user data is stored in the Media data chunk.
    • The -z option checks all recorded AVI files. If the -n option is absent, it recovers corrupted AVI files.
    • The -e option is required to check external hard disk storage devices such as HDDs or SSDs.
    • <disk path> is a mandatory argument and represents the path of the storage device to be checked. The storage device path can be verified using commands such as lsblk or mount.

    The execution result codes of the fsck.offs command are as follows:

    Name
    Value
    Description
    Ok 0 No problems were found.
    NeedFormat 1 Formatting is required.
    NoFAT32 2 No FAT32 partition was found.
    NoDev 3 Storage device was not found.
    Retry 4 Internal error. Please retry.
    BadMBR 5 MBR is missing or corrupted.
    NoVolumeSize 6 Volume size is missing.
    BadPBR 7 PBR is missing or corrupted.
    NotOFFS 8 Not an OFFS format.
    BadOFFS 9 Corrupted OFFS format.
    BadOptions 10 Unknown command option.
    MBRReadError 11 MBR read error. Check the connection status of the SD card.
    NoRecoverySpace 12 Insufficient space required to restore data. Full format is required.
    BadMBRSignature 13 Corrupted MBR signature (55 AA).
    ReadOnlyDev 14 Read-only storage device.
    DevIoctlError 15 Device ioctl() error.
    UnknownVolumeLabel 16 Unknown volume label.
    UnknownSignature 17 Unknown Signature.

    The execution result code of the fsck.offs command in the shell can be identified by the $? value.

    $ echo $?
    0
    

    fsck.offs Check Result Reports#

    When the fsck.offs check is completed, the following three files are created in the /tmp folder:

    • /tmp/offs.signature The Signature string of the user section within the environment file used for formatting. It is a string of up to 12 characters with no newline.
    • /tmp/offs.rootfiles The list of files existing in the root directory. It is empty if no files exist.
    • /tmp/offs.info The folder configuration details applied to formatting.

    Below are examples of the contents of each file.

    Example of /tmp/offs.signature content:

    32GB_DRV
    

    Example of /tmp/offs.rootfiles content. Two files exist:

    README.txt
    Settings.ini
    

    Example of /tmp/offs.info content. The result key value represents the check result code:

    version=3.14
    result=0
    mode=driving
    folders=6
    folder1=DRIVING
    folder1_size=180
    folder1_percent=50
    folder1_mode=0
    folder1_files=85
    folder2=PARKING
    folder2_size=180
    folder2_percent=20
    folder2_mode=0
    folder2_files=34
    folder3=EVENT
    folder3_size=24
    folder3_percent=10
    folder3_mode=0
    folder3_files=128
    folder4=MOTION
    folder4_size=24
    folder4_percent=10
    folder4_mode=0
    folder4_files=128
    folder5=SNAPSHOT
    folder5_size=0
    folder5_percent=0
    folder5_mode=1
    folder5_files=0
    folder6=Config
    folder6_size=0
    folder6_percent=0
    folder6_mode=2
    folder6_files=0
    

    Examples of fsck.offs Usage#

    Below is a usage example of automatically unmounting and automatically repairing:

    $ fsck.offs /dev/mmcblk0p1
    
    version: 3.14.4(arm64) (build 48643)
    dev path: /dev/mmcblk0p1
    disable auto repair
    WR chunk 131072 buf 1024K
    /dev/mmcblk0 readonly? 0
    MBR fs 8160
    PBR cl 16384, spc 32, bps 512
    OFFS(ver. 3.14, type 1) detected
    FAT 0x404000 0xb7c000 32 15296
    DAT 0x12f4000 1 1
    VOLUME: MYSD
    WR align 16384 chunk 131072
    SIGNATURE: 32GB_DRV
    Configuration#6:
       DRIVING   50%   180 MB #85   -0    69 32 #43
       PARKING   20%   180 MB #34   -0    979525 75 #18
         EVENT   10%    24 MB #128  -0    1371461 93 #65
        MOTION   10%    24 MB #128  -0    1568581 158 #65
      SNAPSHOT    0%     0 MB #0    -0    1765701 0 #0
        Config    0%     0 MB #0    -0    1765957 0 #0
    DRIVING repairable
    PARKING repairable
    EVENT repairable
    MOTION repairable
    signature path: /tmp/offs.signature
    rootfiles path: /tmp/offs.rootfiles
    offs info path: /tmp/offs.info
    signature: 32GB_DRV
    OFFS check passed successfully (1090548 usec).
    $ echo $?
    

    Below is a usage example without unmounting and without automatic repair. This is an example of checking the OFFS file system of the SD card while an Oasis application is using OFFS.

    $fsck.offs -nx /dev/mmcblk0p1$ echo $?
    

    Below is a usage example without unmounting an external hard disk and without automatic repair.

    $fsck.offs -enx /dev/sdk$ echo $?
    

    Below is a usage example of recovering corrupted AVI files when the user data preservation method of the AVI recording file is 1.

    $fsck.offs -i 1 /dev/mmcblk0p1$ echo $?
    

    Below is a usage example of verifying whether there are corrupted AVI files among the recorded AVI files while an Oasis application is recording.

    $fsck.offs -nxz /dev/mmcblk0p1$ echo $?
    

    Checking Dump Images#

    This is a method to check an SD card dump image or a virtual block device (loopback device) file.

    If the device that used the SD card is arm64-based and the desktop checking the dump image is x86_64, fsck.offs for x86_64 is required.

    1. Find an empty loopback device using the losetup -f command.

      $ losetup -f
      /dev/loop11
      
    2. Connect the dump image to the loopback device.

      $ sudo losetup /dev/loop11 <path to disk dump image file>
      
    3. Optionally, you can check the file system of the dump image.

      $ sudo losetup -s /dev/loop11
      
    4. Check the dump image connected to the loopback device.

      $ sudo fsck.offs -d /dev/loop11
      
    5. Optionally, mount the loopback device to verify the contents.

      $ sudo offs.fuse -d /dev/loop11 <path to directory to mount>
      

      Unmount.

      $ sudo umount <path to mounted directory>
      
    6. When the check is finished, detach the loopback device in use.

      $ sudo losetup -d /dev/loop11