Using grml for cloning disks, partitions and files

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


Useful tools

  • dd: convert and copy a file
  • dd_rescue: copies data from one file (or block device) to another
  • pcopy: a replacement for dd
  • partimage: back up and restore disk partitions
  • dirvish: Disk based virtual image network backup system
  • devclone: in-place filesystem conversion – device cloning
  • ntfsclone: efficiently clone, image, restore or rescue an NTFS
  • dump: ext2/3 filesystem backup
  • udpcast: multicast file transfer tool
  • cpio: copy files to and from archives
  • pax: read and write file archives and copy directory hierarchies
  • netcat / ssh / tar / gzip / bzip2: additional helper tools
  • zsplit: not just files, can also copy a device irrespective of file system (compression optional)

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 30000 -w 3
# or
dd if=/dev/hda1 | nc 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)

  • g4u - Harddisk Image Cloning for PCs


Useful tools

  • rdiff-backup - local/remote mirror and incremental backup
  • rsync: faster, flexible replacement for rcp
  • ncp: copy files over TCP
  • unison: a file-synchronization tool for Unix and Windows
  • dcfldd: usage like dd, but shows progress
  • aimage , afcat, afinfo : makes compressed images

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

cloning.txt · Last modified: 2012/05/24 08:35 by az
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Grml homepage Driven by DokuWiki