Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

note: all = all that i've found

all the "cloning with dd" information talks about how dd copies all the "empty space", but literally all writings seem to be responding to a situation where filesystems fill up the entire disk.

what about the situation where i have two partitions that together fill up only 10% of 160G disk. what is the image size going to be for the good ol "dd if=/dev/sda of=disk.img" run: 16G or 160G?

unless i'm blind, Using DD for disk cloning does not have this information.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

sda is the disk as a whole - 160 GB

sda1 is the first partition on that disk - 8 GB (say)

sda2 is the second partition on that disk - 8 GB (say)

If you only want to clone the 16 GB of filesystem data, use dd on sda1 and sda2.

To restore the data to a different disk you'd have to first partition that disk (ideally identically to the original disk). I expect you'd probably have to reinstall the bootloader too.

See, for example, http://www.backuphowto.info/linux-backup-hard-disk-clone-dd

share|improve this answer
    
yeah, if the goal is to have minimum whole-disk image size with a single dd command, you are saying there is no difference to dd whether empty space resides inside filesystem or in non-partitioned space. right? –  lkraav Nov 6 '10 at 16:55
    
dd can't tell the difference between "empty space" and space filled with data. You can minimize the image size by compressing it with gzip but obviously this takes time. I suppose you could minimise the size of a gzipped dd of sda by creating a new partition to occupy the remaining disk space and filling that partition with zeroes or some regular pattern. However I doubt there are many cases where this would be worthwhile. –  RedGrittyBrick Nov 6 '10 at 17:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.