[comp.unix.ultrix] Disk Paritioning Clobbered

houck@m.cs.uiuc.edu (Chris Houck) (06/20/91)

I was following the suggestions posted here recently about using spare 'a' 
partitions to hold backup copies of /  So I did a dd from rz0a to rz1a 
and, of course, clobbered the paritioning for disk rz1 (it was a different
size + had more partitions)  

So, doing a 'chpt -q rz1' gives me the partition table for rz0 rather than the
one I set up for rz1.  I can still access all of the partitions on rz1 and
df gives the proper filesystem sizes, so the correct data is in the kernel somewhere.
How can I flush it out to the disk?  

Thanks
-Chris
(houck@biobio.cs.uiuc.edu)

mjr@hussar.dco.dec.com (Marcus J. Ranum) (06/20/91)

houck@m.cs.uiuc.edu (Chris Houck) writes:
>
>So, doing a 'chpt -q rz1' gives me the partition table for rz0 rather than the
>one I set up for rz1.

	Well, if you used the default partition map, you could try blasting
another copy back onto the disk with 'chpt -d' - if not, it's probably faster
to just dump/restore, especially if you can do the dump/restore to disk
on some other drive.

mjr.
-- 
THIS IS A DISCLAIMER. That's because there is always some IDIOT out there who
sees a posting by me, gets the idea that I have an inside line on corporate
policy, and gets bent out of shape. If you can figure out how someone smart
enough to slobber on a keyboard can make such a leap of faith, please tell me.

grr@cbmvax.commodore.com (George Robbins) (06/20/91)

In article <1991Jun19.221738.4983@m.cs.uiuc.edu> houck@m.cs.uiuc.edu (Chris Houck) writes:
> 
> I was following the suggestions posted here recently about using spare 'a' 
> partitions to hold backup copies of /  So I did a dd from rz0a to rz1a 
> and, of course, clobbered the paritioning for disk rz1 (it was a different
> size + had more partitions)  

Ouch, you gotta watch that.  dd'ing "a" or "c" involves risks of overwriting
patitition tables and/or bad block areas (antiquity).  dd'ing a is ok when
the two disks are of the same nature and parititioning.

> So, doing a 'chpt -q rz1' gives me the partition table for rz0 rather than the
> one I set up for rz1.  I can still access all of the partitions on rz1 and
> df gives the proper filesystem sizes, so the correct data is in the kernel somewhere.
> How can I flush it out to the disk?  

Try chpt -a, it appears that it writes the working parition table back onto the
disk.  If this fails you simply chpt the individual partitions back to where
they were.  Hopefully, the modified partiting is written down somewhere, else
it can be really painful trying to reconstruct your thinking...

-- 
George Robbins - now working for,     uucp:   {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing:   domain: grr@cbmvax.commodore.com
Commodore, Engineering Department     phone:  215-431-9349 (only by moonlite)

ian@sibyl.eleceng.ua.OZ (Ian Dall) (06/25/91)

In article <22595@cbmvax.commodore.com> grr@cbmvax.commodore.com (George Robbins) writes:
>In article <1991Jun19.221738.4983@m.cs.uiuc.edu> houck@m.cs.uiuc.edu (Chris Houck) writes:
>> 
>>  So I did a dd from rz0a to rz1a 
>> and, of course, clobbered the paritioning for disk rz1 (it was a different
>> size + had more partitions)  
>
>Ouch, you gotta watch that.  dd'ing "a" or "c" involves risks of overwriting
>patitition tables and/or bad block areas (antiquity).

Which is one of the reasons I think sticking the partition information in
the super block sucks. It is a *bit* better than having it built into
the kernel sevice driver, but that is not the only alternative.

On a System V box I am familiar with (could be common in the sysV world for
all I know) the disk partition information is kept in the first two blocks
of the (physical) disk. By convention the partition table defines those
two blocks as being a partition (6) so that a program (dpart like chpt)
can get at the partition table to modify it.

The advantages of this scheme are:

  1) You can use dd to make copies of all your partition tables in
     ordinary files. Keep these files on more than one disk and you should
     always be able to restore a partition table, even if you have to format
     at disk.

     Whilst you can certainly make copies of the superblock, you don't really
     want to trash other superblock info when you copy it back (or to another
     disk).

  2) There is nothing special about any partition except the one with the
     two blocks for the partition table in it. You can put swap anywhere
     except on the 2 block partition containing the partition table.


-- 
Ian Dall          I'm not into isms, but hedonism is the most
                  harmless I can think of. -- Phillip Adams
  ACSnet: ian@sibyl.eleceng.ua.oz
internet: ian@sibyl.eleceng.ua.oz.au