[sclug] dd question without blowing myself away

Pieter Claassen pieter at openauth.co.uk
Sat Oct 25 09:05:33 UTC 2003


I think you confirm what I thought (dd will fry the disk if the disk is not
exactly the same size (same geometry?) between two copies)

What I have is:
1. MBR in /dev/hda
2. Linux system 1 on /dev/hda1 which contains lilo.conf that wrote MBR
3. Linux system 2 on /dev/hda2 which wrote its own copy of partition table
to /dev/hda2 with lilo
4. Lilo.conf for system 1 lists system 2 as "other" os config and chains the
bootloader of System 2 in /dev/hda2
I then "dd if=/dev/hda1 of /images/image_system1.img bs=2M" while booted in
System2

The question is just whether it is possible to use dd to make a partition
that can be restored to a disk that is slightly larger that the one you made
it from.
Actually, I guess that dd will render a copy useless if the partition table
is not valid.

What will happen if I change the block (or sector) size on a partition and
then use dd to overwrite this disk?

Cheers,
Pieter
----- Original Message -----
From: "David Given" <dg at tao-group.com>
To: <sclug at sclug.org.uk>
Sent: Friday, January 31, 2003 2:48 PM
Subject: Re: [sclug] dd question without blowing myself away


> -----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-----
>
> _______________________________________________
> sclug mailing list
> sclug at sclug.org.uk
> http://www.sclug.org.uk/mailman/listinfo/sclug
>
>





More information about the Sclug mailing list