Simple way for creating disk Image

Posted in June 24th, 2007
by peorex in How to

The simplest way I know for creating disk images under is using dd command. The disk is treated as regular file. Because this is raw coping, it works the same way regardless of disk format, filesystem and data. Disk is copied sector by sector.

For example (in my case), run as root:
#dd bs=8M if=/dev/hda3 of=/home/root/Backups/hda3.img

The image file hda3.img contains all information from hda3 partition, including system data, user data and empty space. No compression is applied. The size of image is equal to disk size.

To restore disk from image, run as root:
#dd bs=8M if=/home/root/Backups/hda3.img of=/dev/hda3

If compression is desired gzip command can be used.

To create image, run as root:
#cat /dev/hda3 | gzip >/home/root/Backups/hda3.img.gz

To restore image, run as root:
#gunzip -c /home/root/Backups/hda3.img.gz >/dev/hda3

For large disk thees processes may take a while. Of course, ensure you have enough disk space.

Tags:
Follow-up responses to this entry through the RSS feed, Leave a Reply or Trackback from your own site.

Leave a Reply

 Username (*required)

 Email Address (*private)

 Website (*optional)