mkfs.f2fs

create an F2FS file system

mkfs.f2fs [ -a 0|1 ] [ -l volume-label ] [ -o overprovision%] [ -s segments-per-section ] [ -z sections-per-zone ]
                    [ -e extenstion-list ] [ -d debugg-level ] device [sectors]

Create a f2fs file system (usually in a disk partition). device is the special file corresponding to the device (e.g. /dev/sdXX). sectors is optionally given for specifing the filesystem size.

-a 0 |1 disable|enable heap based block allocation policy. WHen enabled each of active log areas are initially assigned separately according to the whole volume size. default 1.
-l vol-label
-o nn percentage over the volume size for overprovision area. This area is hidden to users, and utilized by F2FS cleaner.
Default: best number will be assigned according to the partition size.
-s n number of segments per section. A section consists of multiple consecutive segments, and is the unit of garbage collection. Default 1.
-z nn number of sections per zone. A zone consists of multiple sections. F2FS allocates segments for active logs with separated zones as much as possible. default 1,
-e extension-list file extension list in order f2fs to treat them as cold files. The data of files having those extensions will be stored to the cold log. default list includes most of multimedia file extensions such as jpg, gif, mpeg, mkv
-d n level of debugging . default 0, shows basic debugging messages.

sudo mkfs.f2fs -d9 -l DATA /dev/mmcblk0p3

    F2FS-tools: mkfs.f2fs Ver: 1.7.0 (2016-07-28) raspberry pi OLD!

Info: Debug level = 9
Info: Label = DATA
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 12582912 (6144 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018"
Info: Discarding device
Info: This device doesn't support BLKSECDISCARD
Info: Discarded 12582912 sectors
[f2fs_init_sit_area: 362]   Filling sit area at offset 0x00600000
[f2fs_init_nat_area: 396]   Filling nat area at offset 0x00a00000
[f2fs_write_root_inode: 786]    Writing root inode (hot node), 3200 be6 200 at offset 0x12578816
[discard_obsolete_dnode: 720]   Discard dnode, at offset 0x0017fc00
[f2fs_update_nat_root: 838]     Writing nat root, at offset 0x00a00000
[f2fs_add_default_dentry_root: 881]     Writing default dentry root, at offset 0x17f800000
Info: Overprovision ratio = 2.570%
Info: Overprovision segments = 161 (GC reserved = 85)
[f2fs_write_check_point_pack: 504]  Writing main segments, cp at offset 0x00200000
[f2fs_write_check_point_pack: 581]  Writing Segment summary for HOT/WARM/COLD_DATA, at offset 0x00201000
[f2fs_write_check_point_pack: 596]  Writing Segment summary for HOT_NODE, at offset 0x00202000
[f2fs_write_check_point_pack: 608]  Writing Segment summary for WARM_NODE, at offset 0x00203000
[f2fs_write_check_point_pack: 619]  Writing Segment summary for COLD_NODE, at offset 0x00204000
[f2fs_write_check_point_pack: 627]  Writing cp page2, at offset 0x00205000
[f2fs_write_check_point_pack: 644]  Writing cp page 1 of checkpoint pack 2, at offset 0x00400000
[f2fs_write_check_point_pack: 662]  Writing cp page 2 of checkpoint pack 2, at offset 0x00405000
[f2fs_write_super_block: 689]   Writing super block, at offset 0x00000000
Info: format successful
exit code :0 on success and 1 on failure.

AVAILABILITY

From git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git

See

mkfs(8), fsck.f2fs(8), dump.f2fs(8), defrag.f2fs(8), resize.f2fs(8), sload.f2fs(8).


fsck.f2fs

check a Linux F2FS file system

fsck.f2fs [ -a enable auto fix ] [ -f enable force fix ] [ -p enable preen mode ] [ -t show stored directory tree ] [ -d debugging-level ] device Check an f2fs file system
-a enable auto fix run file system check only if a bug was reported by the F2FS kernel module. disabled by default.
-f enable force fix fix all the inconsistency in the partition.
-p enable preen mode Same as "-a" to support general fsck convention.
-t show stored directory tree show every directory entries in the partition.
-d debug-level level of debugging . default 0, shows basic debugging messages.
sudo fsck.f2fs  -d 9 /dev/mmcblk0p3
Info: Debug level = 9
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 12582912 (6144 MB)
Info: MKFS version
  "Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018"
Info: FSCK version
  from "Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018"
    to "Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018"
Info: superblock features = 0 : 
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
[check_sector_size:1908]    Writing super block, at offset 0x00000000

+--------------------------------------------------------+
| Super block                                            |
+--------------------------------------------------------+
magic                               [0xf2f52010 : 4076150800]
major_ver                           [0x       1 : 1]
volum_name                          [DATA]
minor_ver                           [0x       7 : 7]
log_sectorsize                      [0x       9 : 9]
log_sectors_per_block               [0x       3 : 3]
log_blocksize                       [0x       c : 12]
log_blocks_per_seg                  [0x       9 : 9]
segs_per_sec                        [0x       1 : 1]
secs_per_zone                       [0x       1 : 1]
checksum_offset                     [0x       0 : 0]
block_count                         [0x  180000 : 1572864]
section_count                       [0x     be7 : 3047]
segment_count                       [0x     bff : 3071]
segment_count_ckpt                  [0x       2 : 2]
segment_count_sit                   [0x       2 : 2]
segment_count_nat                   [0x       e : 14]
segment_count_ssa                   [0x       6 : 6]
segment_count_main                  [0x     be7 : 3047]
segment0_blkaddr                    [0x     200 : 512]
cp_blkaddr                          [0x     200 : 512]
sit_blkaddr                         [0x     600 : 1536]
nat_blkaddr                         [0x     a00 : 2560]
ssa_blkaddr                         [0x    2600 : 9728]
main_blkaddr                        [0x    3200 : 12800]
root_ino                            [0x       3 : 3]
node_ino                            [0x       1 : 1]
meta_ino                            [0x       2 : 2]
cp_payload                          [0x       0 : 0]
version                       Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018
Info: total FS sectors = 12582912 (6144 MB)
Info: CKPT version = 1

+--------------------------------------------------------+
| Checkpoint                                             |
+--------------------------------------------------------+
checkpoint_ver                      [0x       1 : 1]
user_block_count                    [0x  168c00 : 1477632]
valid_block_count                   [0x       2 : 2]
rsvd_segment_count                  [0x      55 : 85]
overprov_segment_count              [0x      a1 : 161]
free_segment_count                  [0x     be1 : 3041]
alloc_type[CURSEG_HOT_NODE]         [0x       0 : 0]
alloc_type[CURSEG_WARM_NODE]        [0x       0 : 0]
alloc_type[CURSEG_COLD_NODE]        [0x       0 : 0]
cur_node_segno[0]                   [0x     be6 : 3046]
cur_node_segno[1]                   [0x     be5 : 3045]
cur_node_segno[2]                   [0x     be4 : 3044]
cur_node_blkoff[0]                  [0x       1 : 1]
cur_node_blkoff[1]                  [0x       0 : 0]
cur_node_blkoff[2]                  [0x       0 : 0]
alloc_type[CURSEG_HOT_DATA]         [0x       0 : 0]
alloc_type[CURSEG_WARM_DATA]        [0x       0 : 0]
alloc_type[CURSEG_COLD_DATA]        [0x       0 : 0]
cur_data_segno[0]                   [0x     be3 : 3043]
cur_data_segno[1]                   [0x       1 : 1]
cur_data_segno[2]                   [0x       0 : 0]
cur_data_blkoff[0]                  [0x       1 : 1]
cur_data_blkoff[1]                  [0x       0 : 0]
cur_data_blkoff[2]                  [0x       0 : 0]
ckpt_flags                          [0x       5 : 5]
cp_pack_total_block_count           [0x       6 : 6]
cp_pack_start_sum                   [0x       1 : 1]
valid_node_count                    [0x       1 : 1]
valid_inode_count                   [0x       1 : 1]
next_free_nid                       [0x       4 : 4]
sit_ver_bitmap_bytesize             [0x      40 : 64]
nat_ver_bitmap_bytesize             [0x     1c0 : 448]
checksum_offset                     [0x     ffc : 4092]
elapsed_time                        [0x       0 : 0]
sit_nat_version_bitmap[0]           [0x       0 : 0]


[lookup_nat_in_journal:1666] ==> Found nid [0x3] in nat cache
[build_nat_area_bitmap:1835] ino[0x       3] maybe is inode
[build_nat_area_bitmap:1842] nid[0x3] in nat cache
[build_nat_area_bitmap:1887] valid nat entries (block_addr != 0x0) [0x       1 : 1]
[build_sit_area_bitmap:1375] Blocks [0x2 : 2] Free Segs [0xbe1 : 3041]

Info: checkpoint state = 5 :  compacted_summary unmount
[lookup_nat_in_journal:1666] ==> Found nid [0x3] in nat cache
[lookup_nat_in_journal:1666] ==> Found nid [0x3] in nat cache
[lookup_nat_in_journal:1666] ==> Found nid [0x3] in nat cache
[fsck_chk_dentry_blk:1426] [  1] Dentry Block [0x17f800] Done : dentries:0 in 214 slots (len:255)

[fsck_chk_inode_blk: 809] Directory Inode: 0x3 [] depth: 1 has 0 files


[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x0]
[FSCK] valid_block_count matching with CP             [Ok..] [0x2]
[FSCK] valid_node_count matcing with CP (de lookup)   [Ok..] [0x1]
[FSCK] valid_node_count matcing with CP (nat lookup)  [Ok..] [0x1]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x1]
[FSCK] free segment_count matched with CP             [Ok..] [0xbe1]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]

Done.


exit code: 0 on success and -1 on failure.


sload.f2fs

load directories and files into the device directly

sload.f2fs [ -f source directory path ] [ -t mount point ] [ -d debugging-level ] device

load directories and files into a disk partition.

-f source directory path source directory path to be loaded.
-t mount point path mount point path in the partition to load.
-d debug-level default 0, which shows basic debugging messages.