dd question, what am I doing wrong?

Daniel B. Thurman dant at cdkkt.com
Sat Dec 5 00:13:33 UTC 2009


On 12/04/2009 03:44 PM, Patrick O'Callaghan wrote:
> On Fri, 2009-12-04 at 14:07 -0800, Daniel B. Thurman wrote:
>   
>>>> What am I doing wrong here and how do I get around this?
>>>>     
>>>>         
>>> You have to resize Disk2 to 250Gb with resize2fs or parted.
>>>   
>>>       
>> Ok, I used gparted to shrink the size of the partition and grow the
>> partition again.  That did the trick.
>>
>> I wonder if it would have been easier to just:
>>
>> resize2fs /dev/sdb1
>>     
> The whole approach is wrong IMHO. Unless the two partitions are the same
> size there's no particular point in using dd for this. Much better to
> create (mkfs) a new filesystem on the new partition, then use tar, or
> rsync, or even "cp -r" to copy the contents. I doubt it's slower than dd
> +resize, doesn't copy anything except file blocks that are actually in
> use, and has the potential advantage of leaving you with a better layout
> at the end. You can also take advantage of the copy to change filesystem
> types, e.g. from ext3 to ext4.
>
> poc
>   
The two partitions are not the same.  And there is the problem
of UUID and SeLinux.  I used rsync, and I noticed certain types
of problems due to the OS using UUID in various places.  As for
SeLinux, you are forced to relabel, otherwise you might get
certain problems, one example is that you might not be able to
log in.

The problem I have specifically with rsync (or tar, or cp) is that
it does not save ACLs, file attributes too well, and so on that I
gave up using it.  Perhaps the problem in this case is not to use
the -a option but to use the manual options to save everything
about the files that you can.

Specifically:
rsync manual:
-a, --archive        archive mode; equals -rlptgoD (no -H,-A,-X)
-H, --hard-links   preserve hard links
-A, --acls             preserve ACLs (implies -p)
-X, --xattrs          preserve extended attributes

I don't use UUID but labels and it helps me to keep track
of mulit-boot partitions, exactly where I need them.

As for dd, I have resorted to using ddrescue in cases where
there are partition errors.  This saved my a$$, big time.

So far, I am a happy camper.  I have many linux distros, other
OSes, Windows - all that.  The only "snag" now is dealing with
Vista - a different animal that I hope to resolve soon enough.

FWIW,
Dan




More information about the fedora-list mailing list