News: 0001503893

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

F2FS File-System Adding Device Aliasing Feature For Nifty Uses

([Linux Storage] 5 Hours Ago F2FS)


The Flash-Friendly File-System ( [1]F2FS ) is adding a device aliasing file feature that could appear in the upcoming Linux v6.13 merge window.

Queued this past week into the F2FS file-system's Git development tree for the kernel driver in its "dev" branch is this new device aliasing feature.

Device aliasing files can be created using the mkfs.f2fs tool as a special file that could contain another file-system or similar. The pending [2]documentation explains of the device aliasing file feature for F2FS:

f2fs can utilize a special file called a "device aliasing file." This file allows the entire storage device to be mapped with a single, large extent, not using the usual f2fs node structures. This mapped area is pinned and primarily intended for holding the space.

Essentially, this mechanism allows a portion of the f2fs area to be temporarily reserved and used by another filesystem or for different purposes. Once that external usage is complete, the device aliasing file can be deleted, releasing the reserved space back to F2FS for its own use.

use-case

# ls /dev/vd*

/dev/vdb (32GB) /dev/vdc (32GB)

# mkfs.ext4 /dev/vdc

# mkfs.f2fs -c /dev/ [3][email protected] /dev/vdb

# mount /dev/vdb /mnt/f2fs

# ls -l /mnt/f2fs

vdc.file

# df -h

/dev/vdb 64G 33G 32G 52% /mnt/f2fs

# mount -o loop /dev/vdc /mnt/ext4

# df -h

/dev/vdb 64G 33G 32G 52% /mnt/f2fs

/dev/loop7 32G 24K 30G 1% /mnt/ext4

# umount /mnt/ext4

# f2fs_io getflags /mnt/f2fs/vdc.file

get a flag on /mnt/f2fs/vdc.file ret=0, flags=nocow(pinned),immutable

# f2fs_io setflags noimmutable /mnt/f2fs/vdc.file

get a flag on noimmutable ret=0, flags=800010

set a flag on /mnt/f2fs/vdc.file ret=0, flags=noimmutable

# rm /mnt/f2fs/vdc.file

# df -h

/dev/vdb 64G 753M 64G 2% /mnt/f2fs

So, the key idea is, user can do any file operations on /dev/vdc, and reclaim the space after the use, while the space is counted as /data. That doesn't require modifying partition size and filesystem format.

This F2FS device aliasing feature can currently be found in the [4]f2fs.git dev branch and if all goes well could appear with the upcoming Linux 6.13 merge window.



[1] https://www.phoronix.com/search/F2FS

[2] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=128d333f0dff2fbe41c546581c6f151e9d68cd4c

[3] https://www.phoronix.com/cdn-cgi/l/email-protection

[4] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/log/?h=dev



phoronix

<MFGolfBal> rit/ara: There's something really demented about UNIX
underwear...