2016年6月15日 星期三

Linux, Use dd command to backup system

Backup:
# dd if=/dev/hdx bs=1M conv=sync,noerror | gzip > /path/to/image.gz

Hdx could be hda, hdb etc. In the second example gzip is used to compress the image if it is really just a backup.

Restore:
# gzip -dc /path/to/image.gz | dd of=/dev/hdx bs=1M conv=sync,noerror

###################################################

將映像檔依照檔案大小作分割

# dd if=/dev/hdx bs=4k conv=sync,noerror | gzip -c | split -b 2000m - /path/to/backup.img.gz

The - option tells split to read from stdin. Otherwise, split would interpret the /mnt/hdc1... as the file to be split.

# cat /mnt/hdx/backup.img.gz.* | gzip -dc | dd of=/dev/hda1 bs=4k conv=sync,noerror

沒有留言:

張貼留言