[转载]Image Your Hard Drive using dd
2008-06-25 17:12
369 查看
I have backed up my system to an external ximeta drive using "dd" and the well-known linux live cd distribution, Knoppix to boot from. Below are the steps in brief:
Boot from the live cdrom distribution.
Switch to root.
Make sure NO partitions are mounted from the source hard drive.
Mount the external HD.
Backup the drive.
"dd" is the command to make a bit-by-bit copy of "if=/dev/hda" as the
"Input File" to "of=/mnt/sda1/hda.img.gz" as the "Output File".
Everything from the partition will go into an "Output File" named
"hda.img.gz". "conv=sync,noerror" tells dd that if it can't read a
block due to a read error, then it should at least write something to
its output of the correct length. Even if your hard disk exhibits no
errors, remember that dd will read every single block, including any
blocks which the OS avoids using because it has marked them as bad.
"bs=64K" is the block size of 64x1024 Bytes. Using this large of block
size speeds up the copying process. The output of dd is then piped
through gzip to compress it.
To restore your system:
Store
extra information about the drive geometry necessary in order to
interpret the partition table stored within the image. The most
important of which is the cylinder size.
Notes:
One of the disadvantages of the dd method over software specifically
designed for the job such as Ghost or partimage is that dd will store
the entire partition, including blocks not currently used to store
files, whereas the likes of Ghost understand the filesystem and don't
store these unallocated blocks. The overhead isn't too bad as long as
you compress the image and the unallocated blocks have low entropy. In
general this will not be the case because the emtpy blocks contain
random junk from bygone files. To rectify this, it's best to blank all
unused blocks before making the image. After doing that, the
unallocated blocks will contain mostly zeros and will therefore
compress down to almost nothing.
Mount the partition, then create a file of zeros which fills the entire disk, then delete it again.
References:
backup-hard-disk-partitions
linux_loopback
imagedrive
Boot from the live cdrom distribution.
Switch to root.
Make sure NO partitions are mounted from the source hard drive.
Mount the external HD.
# mount -t vfat /dev/sda1 /mnt/sda1
Backup the drive.
# dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c > /mnt/sda1/hda.img.gz
"dd" is the command to make a bit-by-bit copy of "if=/dev/hda" as the
"Input File" to "of=/mnt/sda1/hda.img.gz" as the "Output File".
Everything from the partition will go into an "Output File" named
"hda.img.gz". "conv=sync,noerror" tells dd that if it can't read a
block due to a read error, then it should at least write something to
its output of the correct length. Even if your hard disk exhibits no
errors, remember that dd will read every single block, including any
blocks which the OS avoids using because it has marked them as bad.
"bs=64K" is the block size of 64x1024 Bytes. Using this large of block
size speeds up the copying process. The output of dd is then piped
through gzip to compress it.
To restore your system:
# gunzip -c /mnt/sda1/hda.img.gz | dd of=/dev/hda conv=sync,noerror bs=64K
Store
extra information about the drive geometry necessary in order to
interpret the partition table stored within the image. The most
important of which is the cylinder size.
# fdisk -l /dev/hda > /mnt/sda1/hda_fdisk.info
Notes:
One of the disadvantages of the dd method over software specifically
designed for the job such as Ghost or partimage is that dd will store
the entire partition, including blocks not currently used to store
files, whereas the likes of Ghost understand the filesystem and don't
store these unallocated blocks. The overhead isn't too bad as long as
you compress the image and the unallocated blocks have low entropy. In
general this will not be the case because the emtpy blocks contain
random junk from bygone files. To rectify this, it's best to blank all
unused blocks before making the image. After doing that, the
unallocated blocks will contain mostly zeros and will therefore
compress down to almost nothing.
Mount the partition, then create a file of zeros which fills the entire disk, then delete it again.
# dd if=/dev/zero of=/tmp/delete.me bs=8M; rm delete.me
References:
backup-hard-disk-partitions
linux_loopback
imagedrive
相关文章推荐
- Take image from corrupted hard drive
- Hiding Data from Forensic Imagers – Using the Service Area of a Hard Disk Drive
- c#中将bitmap或者image保存为清晰的gif --转载自http://tech.ddvip.com/2009-05/1243237863120924.html
- Using the Image control as a pop up (转载)
- Message: ata0-0: could not open hard drive image file '30M.sample'
- [转载]Flip an image in UIImageView using UIView transitionWithView
- IE6下默认不缓存背景图片document.execCommand("BackgroundImageCache", false, true); "转载"
- Adaptive Thresholding Using the Integral Image ( Derek Bradley* Gerhard Roth)
- django using your own package
- DEMAND RESPONSE: USING YOUR DATA CENTER TO MAKE MONEY
- EFI VMware Virtual SCSI Hard Drive (0.0)... unsuccessful
- 转载:实践单元测试-Using NUnit
- Android: ImageLoader must be init with configuration before using
- Sencha Touch 2 官方文档翻译之 Using Views in your Applications(使用视图)
- 分享一篇文章《Using DTrace to Instrument Your System》
- MySQL5.7出现Your password has expired. To log in you must change it using a client that supports expir
- ImageLoader must be init with configuration before using...
- 论文解析之Image Restoration Using Very Deep Convolutional Encoder-Decoder Networks with Symmetric Skip Co
- 转载:dd_engi 的背包九讲
- #273 – 通过Image 控件显示图片(Display a Picture Using an Image Control)