Skip to content

Instantly share code, notes, and snippets.

@krared
Last active August 27, 2018 12:38
Show Gist options
  • Save krared/b998598aaa037871957d1d092c03bee8 to your computer and use it in GitHub Desktop.
Save krared/b998598aaa037871957d1d092c03bee8 to your computer and use it in GitHub Desktop.
Delete noobs and shrink image rpi
1. Repartition new card to have two partitions. The first one exactly the same type and size as /boot, and the second one using the rest of the card as type Linux.
gparted 64mib fat32 sda1
gparted ext4 sda2
2. dd if=/dev/mmcblk0p6 (whatever /boot is) of=/dev/sda1 (the first partition on the new card)
3. mkfs -t ext4 /dev/sda2 (the new Linux partition)
4. mount -t ext4 /dev/sda2 /mnt
5. rsync -ax --progress / /mnt
5.1 if readonly fs fsck -n -f
6. nano /mnt/etc/fstab and change /boot and / to mmcblk0p1 and mmcblk0p2 respectively.
7. umount /mnt
8. mount -t vfat /dev/sda1 /mnt
9. nano /mnt/cmdline.txt and change the root= to /dev/mmcblk0p2
10. umount /mnt
11. Remove card and use it.
12. if you need to shrink image, then use https://gist.github.com/free5ty1e/85f41277e13a2c446b9e3b18163efebf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment