sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL NAME FSTYPE SIZE MOUNTPOINT LABEL sda 57,6G └─sda1 ntfs 57,6G /media/stick WEBDISC01 mmcblk0 60,1G ├─mmcblk0p1 vfat 60M /boot boot └─mmcblk0p2 ext4 60G /The micro SD card on the Raspberry Pi is, as usual, named mmcblk0. It consists of two partitions:
sudo apt-get install f2fs-toolsThen shutdown the Raspberry Pi.
sudo apt-get install f2fs-toolsThen remove the micro SD card from the Raspbrry Pi and insert it into the second Linux computer's SD card drive. Usually on common Linux desktop systems the card's file systems will be auto-mounted, and with
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABELyou'll probably find something like
NAME FSTYPE SIZE MOUNTPOINT LABEL . . . sdb 60,1G ├─sdb1 vfat 60M /media/user/boot boot └─sdb2 ext4 60G /media/user/ad6203a1-ec50-4f44-a1c0-e6c3dd4c9202 . . .The long uid mount point name of the card's ext4 partition is kind of unhandy, so the following step is for better illustration only and thus does not bring us any further:
sudo umount /dev/sdb1 sudo umount /dev/sdb2 sudo mkdir /media/boot_fs sudo mkdir /media/root_fs sudo mount -t vfat /dev/sdb1 /media/user/boot_fs sudo mount -t ext4 /dev/sdb2 /media/user/root_fsNow, the SD card mount is much better readable:
sdb 60,1G ├─sdb1 vfat 60M /media/user/boot_fs └─sdb2 ext4 60G /media/user/root_fswhich means:
sudo cp -a /media/user/root_fs /home/user/backup_root_fsNote that the -a option is important to ensure that really everything, including e.g. hidden/system files, is copied to the backup folder.
sudo umount /dev/sdb2and format it with the the f2fs file system
sudo mkfs.f2fs /dev/sdb2The partition has now a f2fs file system, but is empty, because by formatting all it's content got lost. Thus, we need to
sudo mount -t f2fs /dev/sdb2 /media/user/root_fsnow with the f2fs type option. The SD card mount will then look like this:
sdb 60,1G ├─sdb1 vfat 60M /media/user/boot_fs └─sdb2 f2fs 60G /media/user/root_fsWe can now restore the root file system's content from the backup folder:
sudo cp -a /home/user/backup_root_fs/* /media/user/root_fsA little more to do to make the Raspberry Pi bootable with the SD card. First edit the SD card's /etc/fstab file and adapt the root file system's mount entry to f2fs:
sudo vi /media/user/root_fs/etc/fstab . . . /dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / f2fs defaults,noatime,discard 0 1 . . .Then edit the cmdline.txt file on the SD card's boot partition and adapt the root file system type parameter to f2fs:
sudo vi /media/user/boot_fs/cmdline.txt dwc_otg.lpm_enable=0 console= . . . root=/dev/mmcblk0p2 rootfstype=f2fs elevator=deadline . . .That's it. You can now unmount the SD card's file systems, eject the card and insert it into the Raspberry Pi's card drive. The Pi will hopefully boot normally.