Created
December 24, 2018 22:48
-
-
Save raharper/0d7ca700961036d1b6707e6ce2a7aeda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://cdimage.ubuntu.com/ubuntu/releases/16.04/release/ubuntu-16.04.5-preinstalled-server-armhf+raspi2.img.xz | |
# tarpipe backup rootfs (tar rootfs, one-filesystem to stdout) | |
tar -cpf - --one-file-system / | ssh user@remote "( cat > /path/to/backup/rootfs.tar )" | |
# install rpi2 ubuntu image to sdcard (I used usb sdcard reader) | |
xzcat ubuntu-16.04.5* | dd of=/dev/sda bs=4M | |
sync;sync;sync | |
blockdev --rereadpt /dev/sda | |
# grow rootfs partition | |
growpart /dev/sda 2 | |
# grow ext4 filesystem | |
e2fsck /dev/sda2 | |
resize2fs /dev/sda2 | |
# mount and unpack backup tar | |
mount /dev/sda2 /mnt | |
tar -C /mnt -xvpf /path/to/backup/rootfs.tar --numeric-owner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment