How to Move Raspberry Pi Rootfs to Another Drive/partition?

Introduction: How to Move Raspberry Pi Rootfs to Another Drive/partition?

About: Linux enthusiast Current Instructables are 4-5 years old, I'd rather delete them because of my inconvenient text. ~sigh

Hi again!
Today i show how to move Raspberry Pi rootfs to another drive/partition
You need:
  - External device(min 2GB free)
  - Time
  - A little knowledge of (Arch) Linux
I think EXT4 burns SD card too much(SD cards have limited write/delete), so i decided to make copy of my Raspberry pi root file system and create new partition
I use Arch Linux
I reflashed my SD card and created new partition with fdisk(Pic. 1)
then i made copy of my rootfs with dd
# screen -S backup dd if=/dev/mmcblk0p2 of=/path/to/external/drive/archlinux_rootfs.img bs=1M
Then i runned this command:
# printf "p\nn\np\n3\n\n\nw\n" | fdisk /dev/mmcblkp0
I assume that you didn't change partitions after reflash. This command can brick SD card if you did
Now do reboot, because RPi reads partition table only at boot
Then format that filesystem to JFS and mount it to /mnt/jfs
# mkfs.jfs /dev/mmcblk0p3
# mount /dev/mmcblk0p3 /mnt/jfs
Now mount that external drive and rsync old rootfs to new partition
# mount /dev/(external drive) /mnt/external
# mount -o loop /mnt/external/archlinux_rootfs.img /mnt/rootfs
# screen -S sync rsync -axv /mnt/rootfs /mnt/jfs
And wait about 1-2 hrs
If done, edit /boot/cmdline.txt and change root=/dev/mmcblk0p2 to root=/dev/mmcblk0p3
and do reboot
If it booted, then you're done!

Be the First to Share


    • For the Home Contest

      For the Home Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Make It Bridge

      Make It Bridge