Skip to content

Instantly share code, notes, and snippets.

@rifatx
Last active May 23, 2018 11:15
Show Gist options
  • Save rifatx/b3edda7532d3b9ae9ba66f90d6d174c4 to your computer and use it in GitHub Desktop.
Save rifatx/b3edda7532d3b9ae9ba66f90d6d174c4 to your computer and use it in GitHub Desktop.
sd card backup, restore and partition resize
#backup
dd bs=4M if=/dev/sdb | gzip > sdcard.gz
#restore
gzip -dc sdcard.gz | dd bs=4M of=/dev/sdb
#recreate partition
fdisk
p
# note start sector of partition 2 -> start
d
2
n
p
2
#<-start
#default
n
w
#check for errors & resize
umount /dev/sdb2
e2fsck -f /dev/sdb2
resize2fs /dev/sdb2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment