Translation(s): Français


This page aims to sum up the way of doing clone of Debian machines.

Partclone

partclone allows to clone and restore partitions. It cannot clone in live (the partition must be umounted). In order to clone a entire system, you need to use a LiveUSB to clone (systemrescue or clonezilla for instance)

To clone a partition

To clone an ext4 partition in a file :

partclone.ext4 -c -s /dev/sda1 -o ~/pc1.img

To clone an ext4 partition to a SSH server, compression the image with Gzip:

partclone.ext4 -c -s /dev/sda1 |gzip -c |ssh adrien@serveur 'cat > ~/pc1.img.gz'

To restore a partition

To restore from a file:

partclone.ext4 -r -o /dev/sda1

To restore from the SSH server:

ssh adrien@serveur 'zcat ~/pc1.img.gz' |partclone.ext4 -r -o /dev/sda4

A simple guide to cloning debian onto a bootable usb/ssd and maintaining it as a backup.

# mount /dev/sdb1 /media/backupos -t ext2

# blkid 

 /dev/sdb1: LABEL="backupos" UUID="767ba9eb-bf18-46c0-928d-b3ff13d18f1c" TYPE="ext2"

# dd if=/dev/zero of=/media/backupos/swapfile bs=1M count=1024

# rsync -auv --"exclude=/home/user/[a-zA-Z0-9]*" --"exclude=/proc/*" \ --"exclude=/lost+found/*" --"exclude=/dev/*" --"exclude=/mnt/*" \ --"exclude=/media/*" --"exclude=/sys/*" --"exclude=/tmp/*" \ --"exclude=/etc/fstab*"    /   /media/backupos 

# update-grub

 grub-install --recheck --root-directory=/media/backupos/ /dev/sdb

proc                                 /proc proc    defaults          0 0 767ba9eb-bf18-46c0-928d-b3ff13d18f1c /     ext2    errors=remount-ro 0 1

# swapon /swapfile


CategorySystemAdministration | CategoryRedundant: merge with other ?CategoryBackup pages