disk imaging aka cloning
using dd
http://www.inference.org.uk/saw27/notes/backup-hard-disk-partitions.html
http://www.linuxweblog.com/dd-image
disadvantage of the dd method over using imaging software such as Ghost or partimage
dd will store the entire partition, including blocks not used
whereas Ghost understand the filesystem and don’t store 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 (zeor out) 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.
zippen van dd kan door het door een pipe te sleuren : dd | gzip
option 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, dd will read every single block, including any blocks which the OS avoids because it has marked them as bad.
So dd can struggle to read some blocks. (see the next section for a better way of handling this situation).
alternatieven voor dd :
- ghost
- dd_rescue
- fog
- clonezilla https://clonezilla.org
- partimage
only clone real data , not empty space/sectors
dd is a very low level tool and it has no means of distinguishing between files and empty space.
empty space will compress very nicely so if you are only concerned about storage space, not for example write time, then just pipe it through gzip.
Assuming the free space hasn’t previously been used.
You can zero fill the free space first to ensure the compression works as expected. –
This complicates the process and makes it take even longer.
7Assuming the rest of the drive is empty (all zeros) you could pipe your DD through gzip, which should compress the empty space quite nicely. You can use a tool like zerofree to make sure your empty space is actually blank so it compresses nicely.
tools like partimage, clonezilla or some of the other linux cloning tools, would handle most of this automatically.
However clonezilla :
- either install as a server OR t be used as a life usb/disk (like gparted)
- destination partition must be equal or > then the source