Table of Contents

Using grml for cloning disks, partitions and files

Notice: this page is under construction. Feedback and help appreciated!

Cloning

Useful tools

Usage examples

# Listener:
nc -v -l -p 30000 > hda1.img
# or
nc -v -l -p 30000 | dd of=/dev/hda1
# Source:
dd_rescue /dev/hda1 - | nc 192.168.1.2 30000 -w 3
# or
dd if=/dev/hda1 | nc 192.168.1.2 30000 -w 3

# clone disk via dd
dd if=/dev/hda of=/dev/hdc
Notice: adjust the options to improve performance, for example adjusting blocksize (bs=...) is strongly recommended.

tar cvzSf - directory/ | ssh foobar@target "dd of=/path/to/file.tgz"

export RSYNC_RSH=ssh; rsync -a /mystuff foobar@target_machine:~/

# clone disk via pcopy:
touch /tmp/diskimage.img
pcopy /dev/hda /tmp/diskimage.img

# This one uses CPU cycles on the remote server to compare the files:
ssh target_address cat remotefile | diff - localfile
cat localfile | ssh target_address diff - remotefile
# This one uses CPU cycles on the local server to compare the files:
ssh target_address cat <localfile "|" diff - remotefile

# push via ftp:
lftp user@host:/path mirror -R source target

# pull via ftp: 
lftp user@host:/path mirror source target

# Moving files around on local filesystem:
( cd SOURCEDIR && tar cf - . ) | (cd DESTDIR && tar xvpf - )

# ...
ssh target_address "( nc -l -p 9210 > remotefile & )" && cat source-file | gzip -1 - | nc target_address 9210

# backup specific directories via cpio and ssh:
for f in directory_list; do find $f >> backup.list done
cpio -v -o --format=newc < backup.list | ssh user@host "cat > backup_device"

# overwrite your first hard disk with null bytes:
dd if=/dev/zero of=/dev/hda

# securely erase files/partitions (please take a look at the
# manpage for some more information regarding security of deleting):
wipe -kq /dev/hda1

# clone using dump:
mke2fs -j /dev/target
mkdir -p /mnt/{source,target} &&\
 mount /dev/target /mnt/target &&\
 mount /dev/source /mnt/source
cd /mnt/target && dump -0f - /mnt/source | restore rf -

External tools (not part of grml)

Backups

Useful tools

aimage /dev/sda1 sda1.aff …..then: afcat sda1.aff | dd of=/dev/sdb1