Saturday, March 21, 2009

Usefull tricks with "dd"

1) create an iso file on a remote machine from a dvd in your station:

dd if=/dev/cdrom | ssh server1 'dd of=/tmp/iso/vmware.iso'



2)
copy the Linux MBR:
dd if=/dev/hda of=hda.mbr bs=512 count=1


3)Create compressed image of a drive :

dd if=/dev/hda1 bs=1M count=150 | gzip > hda1-image.gz

*you should know the size of the partition you're about to compress - use df -h for that.
also replace the "150" with the number of used megabytes on the partition.

4)Wipe a disk from Linux

dd bs=1048576 if=/dev/zero of=/dev/hda

No comments: