Page 1 of 1

Backup your Linux partition

Posted: Tue Jan 10, 2017 12:44 pm
by xeno74
Hi All,

You can create an img from the Linux partition with dd directly.

For example:

Code: Select all

dd if=/dev/sdb1 of=~/ubuntu_MATE_17.04.img
(from another booted Linux system)

If your partition is too big then it is possible to create an img with dd in the size of your used part of the partition and format it. After that mount it and rsync the files to this mounted img.
  1. Boot your Linux system for example ubuntu MATE 17.04
  2. Code: Select all

    dd if=/dev/zero of=ubuntu_MATE_17.04.img count=20000 bs=1M
    (20G image)
  3. Code: Select all

    mkfs.ext4 ubuntu_MATE_17.04.img
  4. Code: Select all

    tune2fs -c0 -i0 ubuntu_MATE_17.04.img
  5. Code: Select all

    sudo mount ubuntu_MATE_17.04.img /mnt/
  6. Code: Select all

    sudo rsync --stats --progress --numeric-ids -axAhHSP  / /mnt/ --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/mnt --exclude=/media
  7. Code: Select all

    sudo mkdir /mnt/tmp /mnt/sys /mnt/proc /mnt/dev /mnt/media
Good luck!

Cheers,
Christian