[sclug] dd question without blowing myself away

David Given dg at tao-group.com
Sat Oct 25 09:05:33 UTC 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 31 January 2003 2:23 pm, Pieter Claassen wrote:
> Hi all,
>
> I have a question about dd (because I am lazy on a Friday afternoon and
> though I would see if there is a person out there that can either think
> through this one or has experience with it ;-). If I dd a file to a
> partition and: a.) The partition is larger than the input file or
> b.) The partition is smaller that the input file
>
> what would happen?
>
> Remember that the disk image contains the partition table.
[...]

I'm not entirely sure what you're asking, here. What exactly are you doing?

On Linux, if you write to /dev/hda1 you can't overwrite /dev/hda2. However, if 
you write to /dev/hda, you can overwrite anything.

The partition table is stored in the first sector of /dev/hda. It is not 
visible from any of the partitions. Therefore, when you write to /dev/hda1, 
you cannot overwrite the partition table.

So, if you dd a file to /dev/hda1, dd will write as much as it can to *that 
partition* and stop. If the file is a disk image, you'll end up with 
something not particularly useful.

All bets are off if you have an invalid partition table (overlapping 
partitions, etc).

Is this helpful?

- -- 
+- David Given --McQ-+ "Quantum materiae materietur marmota monax si
|  dg at cowlark.com    | marmota monax meteriam possit materiari?" --- Henry
| (dg at tao-group.com) | Beard
+- www.cowlark.com --+ 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+Ooy2f9E0noFvlzgRAid9AJ9aqGEivWmUq1c4pMheu2JOeik80gCfcIq8
uFp0C9+HE32RBDhM4lYtX6w=
=8SSR
-----END PGP SIGNATURE-----




More information about the Sclug mailing list