You are not logged in.

#1 2022-12-27 13:00:41

dramm
Member
Registered: 2017-07-17
Posts: 13

[SOLVED] Two F2FS devices as one volume

A couple of years ago I used the following command:

mkfs.f2fs -l volume_label -O extra_attr,inode_checksum,lost_found,sb_checksum -c /dev/sdf1 /dev/sdc1 -f

This created a single volume which I mounted using the following line in fstab:

# /dev/sdc1 combined with sdf1 (M4) uid=dramm,gid=users 
UUID=81e6fa79-9bd6-43a8-b9fb-435b3a6945a0 	/volume_label	f2fs	noauto,x-systemd.automount,,x-systemd.device-timeout=1ms,async,relatime,nodiscard	0 0

after having the computer off for a couple of months and managing the SATA connections (removed some other drives) I now have the drive with the UUID in the fstab showing has `dev/sdc1` and the one that was on `/dev/sdf1` now on `/dev/sde1`.

The volume no longer mounts, I'm guessing the system no longer sees both devices as one volume.
But since its been so long I no longer remember if there were any other files that contained information on the devices that require updating now

Here is the

fsck.f2fs /dev/sdc1 -d 1
Info: Debug level = 1
Info: [/dev/sdc1] Disk Model: M4-CT128M4SSD2  
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 250067599 (122103 MB)
Info: MKFS version
  "Linux version 5.8.9-zen2-1-zen (linux-zen@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 ZEN SMP PREEMPT Sun, 13 Sep 2020 23:45:45 +0000"
Info: FSCK version
  from "Linux version 5.8.9-zen2-1-zen (linux-zen@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 ZEN SMP PREEMPT Sun, 13 Sep 2020 23:45:45 +0000"
    to "Linux version 5.16.11-zen1-2-zen (linux-zen@archlinux) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.38) #1 ZEN SMP PREEMPT Mon, 28 Feb 2022 10:17:33 +0000"
Info: superblock features = a28 :  extra_attr inode_checksum lost_found sb_checksum
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000

+--------------------------------------------------------+
| Super block                                            |
+--------------------------------------------------------+
magic                         		[0xf2f52010 : 4076150800]
major_ver                     		[0x       1 : 1]
volum_name                    		[sidekick]
minor_ver                     		[0x       e : 14]
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     bfc : 3068]
block_count                   		[0x 3b9eea3 : 62516899]
section_count                 		[0x   1db8c : 121740]
segment_count                 		[0x   1dcf5 : 122101]
segment_count_ckpt            		[0x       2 : 2]
segment_count_sit             		[0x       a : 10]
segment_count_nat             		[0x      6e : 110]
segment_count_ssa             		[0x      ef : 239]
segment_count_main            		[0x   1db8c : 121740]
segment0_blkaddr              		[0x     200 : 512]
cp_blkaddr                    		[0x     200 : 512]
sit_blkaddr                   		[0x     600 : 1536]
nat_blkaddr                   		[0x    1a00 : 6656]
ssa_blkaddr                   		[0x    f600 : 62976]
main_blkaddr                  		[0x   2d400 : 185344]
root_ino                      		[0x       3 : 3]
node_ino                      		[0x       1 : 1]
meta_ino                      		[0x       2 : 2]
cp_payload                    		[0x       0 : 0]
crc                           		[0xa1bc3137 : 2713465143]
version                       Linux version 5.8.9-zen2-1-zen (linux-zen@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 ZEN SMP PREEMPT Sun, 13 Sep 2020 23:45:45 +0000
Info: Device[0] : /dev/sdc1 blkaddr = 0--1dcf5ff
	Error: Failed to get the device stat!
[ASSERT] (init_sb_info:1015) 0

And here is the

fsck.f2fs /dev/sde1 -d 1
Info: Debug level = 1
Info: [/dev/sde1] Disk Model: M4-CT128M4SSD2  
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 250067599 (122103 MB)
Magic Mismatch, valid(0xf2f52010) - read(0x0)
	Can't find a valid F2FS superblock at 0x0
Magic Mismatch, valid(0xf2f52010) - read(0x0)
	Can't find a valid F2FS superblock at 0x1

And

lsblk -f
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                         
├─sda1
│    vfat   FAT32       6B40-FC48                             510.8M     0% /efi
└─sda2
     ext4   1.0         7311af53-4da0-4452-8549-871d513e8dca   15.8G    88% /
sdb  crypto 2           619fa077-fb17-4767-a863-5159cd5db26e                
└─knox
     btrfs        Knox  9561b67a-e8ec-4708-963d-62f40cb45bc2    1.7T     4% /knox
sdc                                                                         
└─sdc1
     f2fs   1.14  sidekick
                        81e6fa79-9bd6-43a8-b9fb-435b3a6945a0                
sdd  btrfs        Earth 1e544c52-3899-4bc2-9739-df5a84c32b4b    1.8T    68% /earth
sde                                                                         
└─sde1

Last edited by dramm (2023-01-30 21:36:02)

Offline

#2 2022-12-27 13:34:45

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: [SOLVED] Two F2FS devices as one volume

Interesting. I did not even know that f2fs supported multiple devices. Just tried it with loop devices. It doesn't even put any metadata at all on the additional devices. Barking mad...

So the only reference is the literal device name recorded on the primary device. Once the device name changes... you end up with errors. Impossible to mount.

[19371.313674] F2FS-fs (loop2p1): Failed to find devices

There does not seem to be an obvious way to fix the device names. If you try it with hexedit, you end up corrupting metadata and CRC checksums.

I'd probably just pass an image of these block devices to a VM and create appropriate symlinks to emulate the "correct" device names and hope to resolve things that way. mount f2fs does accept symlinks and mounts the filesystem successfully in that case.

# mkfs.f2fs -l volume_label -O extra_attr,inode_checksum,lost_found,sb_checksum -c /dev/loop0p1 /dev/loop1p1 -f
[...]
# hexdump -C /dev/loop2p1
[...]
00000cc0  6f 6e 65 20 61 6c 69 67  6e 65 64 20 73 65 67 6d  |one aligned segm|
00000cd0  65 6e 74 30 20 62 6c 6b  61 fe 01 00 00 2f 64 65  |ent0 blka..../de|
00000ce0  76 2f 6c 6f 6f 70 30 70  31 00 00 00 00 00 00 00  |v/loop0p1.......|
00000cf0  00 00 00 00 00 21 00 00  00 00 00 00 00 2f 64 65  |.....!......./de|
00000d00  76 2f 6c 6f 6f 70 31 70  31 00 00 00 00 00 00 00  |v/loop1p1.......|
00000d10  00 00 00 00 00 11 04 00  00 00 00 00 00 ff 01 00  |................|
00000d20  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
[...]
# ls -l /dev/loop*
crw-rw---- 1 root disk  10, 237 Dec 27 09:03 /dev/loop-control
brw-rw---- 1 root disk   7,   0 Dec 27 14:25 /dev/loop0
lrwxrwxrwx 1 root root       12 Dec 27 14:29 /dev/loop0p1 -> /dev/loop3p1
brw-rw---- 1 root disk   7,   1 Dec 27 14:25 /dev/loop1
lrwxrwxrwx 1 root root       12 Dec 27 14:29 /dev/loop1p1 -> /dev/loop2p1
brw-rw---- 1 root disk   7,   2 Dec 27 14:25 /dev/loop2
brw------- 1 root root 259,  13 Dec 27 14:25 /dev/loop2p1
brw-rw---- 1 root disk   7,   3 Dec 27 14:25 /dev/loop3
brw------- 1 root root 259,  14 Dec 27 14:25 /dev/loop3p1

I don't recommend using multiple devices for f2fs at all (or even f2fs itself).

If you must use multiple devices with f2fs, let LVM take care of the multiple device aspect for you. At least that way you got some metadata on each device involved and LVM can handle device name changes for you...

EDIT: alternatively using partuuid at mkfs time also seems to be working

# mkfs.f2fs -l volume_label -O extra_attr,inode_checksum,lost_found,sb_checksum -c /dev/disk/by-partuuid/{8219ca81-d204-40e9-9953-56df0c086065,50beb00f-b096-4cbc-a7cf-454b518f2e04} -f

    F2FS-tools: mkfs.f2fs Ver: 1.15.0 (2022-05-13)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Label = volume_label
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 4186112 (2044 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 6.0.12-arch1-1 (linux@archlinux) (gcc (GCC) 12.2.0, GNU ld (GNU Binutils) 2.39.0) #1 SMP PREEMPT_DYNAMIC Thu, 08 Dec 2022 11:03:38 +0000"
Info: [/dev/disk/by-partuuid/50beb00f-b096-4cbc-a7cf-454b518f2e04] Discarding device
Info: This device doesn't support BLKSECDISCARD
Info: Discarded 1022 MB
Info: [/dev/disk/by-partuuid/8219ca81-d204-40e9-9953-56df0c086065] Discarding device
Info: This device doesn't support BLKSECDISCARD
Info: Discarded 1022 MB
Info: Overprovision ratio = 4.470%
Info: Overprovision segments = 94 (GC reserved = 52)
Info: format successful
# hexdump -C /dev/loop1p1
[…]
00001c80  00 00 00 00 28 0a 00 00  00 00 00 00 00 00 00 00  |....(...........|
00001c90  00 00 00 00 00 00 00 00  00 2f 64 65 76 2f 64 69  |........./dev/di|
00001ca0  73 6b 2f 62 79 2d 70 61  72 74 75 75 69 64 2f 35  |sk/by-partuuid/5|
00001cb0  30 62 65 62 30 30 66 2d  62 30 39 36 2d 34 63 62  |0beb00f-b096-4cb|
00001cc0  63 2d 61 37 63 66 2d 34  35 34 62 35 31 38 66 32  |c-a7cf-454b518f2|
00001cd0  65 30 34 00 00 00 00 00  00 fe 01 00 00 2f 64 65  |e04........../de|
00001ce0  76 2f 64 69 73 6b 2f 62  79 2d 70 61 72 74 75 75  |v/disk/by-partuu|
00001cf0  69 64 2f 38 32 31 39 63  61 38 31 2d 64 32 30 34  |id/8219ca81-d204|
00001d00  2d 34 30 65 39 2d 39 39  35 33 2d 35 36 64 66 30  |-40e9-9953-56df0|
00001d10  63 30 38 36 30 36 35 00  00 00 00 00 00 ff 01 00  |c086065.........|
00001d20  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Last edited by frostschutz (2022-12-27 14:44:30)

Offline

#3 2022-12-27 15:51:18

dramm
Member
Registered: 2017-07-17
Posts: 13

Re: [SOLVED] Two F2FS devices as one volume

You are indeed correct!
I rearranged the ports and added another drive so that both SSDs with F2FS were named /dev/sdc and /dev/sdf just like I had them when I formatted them.
It worked straight away!

This is a bit dumb though hehehe
Probably won't continue to use F2FS after this discovery...

@frostschutz Thank you very much for doing those tests and pointing me in the right direction.

Offline

Board footer

Powered by FluxBB