copying partitions

James Wilkinson fedora at westexe.demon.co.uk
Fri May 20 16:31:02 UTC 2005


Michael Hennebry wrote:
> What would dd do?
> I've never had much of a clue what, besides some reformatting,
> dd does that cp does not.
> E.g. if there is no file, there is nothing to which one can set
> if and of, hence dd would copy from standard input to
> standard output.
> I assume there is something wrong with that logic,
> but I don't know what.

Ermm... oops?

I seem to have been labouring under a misapprehension.

I assumed that when you cp a device node, what you get is a copy of the
device node. (And if you use cp -R, you get just that).

cp -R /dev/hda7 /tmp
ls -l /tmp/hda7
brw-r-----  1 root root 3, 65 May 20 16:49 hda7

I thought that was what normal cp did, too.

Instead, cp opens the device node for reading, and copies all the
output. So cp /dev/hda7 /scratch will create a *very* large file in
/scratch. If the appropriate partition contains a filesystem, you'll get
a copy of that filesystem which you should be able to loopback mount.

Thanks for making me check that and learn something,

James.
-- 
E-mail address: james |  ... more holes in Internet Explorer than
@westexe.demon.co.uk  | Blackburn, Lancashire...
                      |     -- http://theinquirer.net/?article=17235




More information about the fedora-list mailing list