AGC | 2 Dec 03:48 2011
Picon

Relabel disk?

Hey guys,

My IPX won't boot because it's missing a disk label.  I can boot from 
the installation CD but I'm not sure how to restore the disk label on 
the disk without wiping and reinstalling everything.

Suggestions?

Thanks

Greg Troxel | 2 Dec 04:25 2011
Picon

Re: Relabel disk?


I'm slightly fuzzy, but disk layout is generally:

0: 1st-stage boot
1: disklabel
2-15: 2nd-stage boot
16-N: filesystem

In other words, the first 16 sectors of a ffs filesystem are left empty
for boot/disklabel stuff.

So if you know what the fs layout is (perhaps just one big fs), you
should be able  to write the disklabel without breaking the fs.
(via rsd0c presumably, which is whole disk on sparc, again if I remember
right)
AGC | 2 Dec 04:28 2011
Picon

Re: Relabel disk?

On 12/1/2011 19:25, Greg Troxel wrote:
>
> I'm slightly fuzzy, but disk layout is generally:
>
> 0: 1st-stage boot
> 1: disklabel
> 2-15: 2nd-stage boot
> 16-N: filesystem
>
> In other words, the first 16 sectors of a ffs filesystem are left empty
> for boot/disklabel stuff.
>
> So if you know what the fs layout is (perhaps just one big fs), you
> should be able  to write the disklabel without breaking the fs.
> (via rsd0c presumably, which is whole disk on sparc, again if I remember
> right)

It was root and swap but I don't remember what was where.  I suspect I'm 
just hosed and have to reinstall if I can't figure out what the 
partitions were.

River Tarnell | 2 Dec 04:32 2011

Re: Relabel disk?


AGC:
> It was root and swap but I don't remember what was where.

Perhaps scan_ffs(8) might be useful?

	- river.
AGC | 2 Dec 05:51 2011
Picon

Re: Relabel disk?

On 12/1/2011 19:32, River Tarnell wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> AGC:
>> It was root and swap but I don't remember what was where.
>
> Perhaps scan_ffs(8) might be useful?

 From the man pages online that sounds like a very useful utility. 
Unfortunately it's not on the NetBSD install CD :(

Mouse | 2 Dec 06:35 2011

Re: Relabel disk?

> My IPX won't boot because it's missing a disk label.  I can boot from
> the installation CD but I'm not sure how to restore the disk label on
> the disk without wiping and reinstalling everything.

sunlabel(8)?  I don't know whether it's on the install CD, but if you
extract it from the CD manually and make it available via NFS, you can
probably boot the install CD and run it off an NFS mount.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse <at> rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Alexander Carver | 2 Dec 07:00 2011
Picon

Re: Relabel disk?

On 12/1/2011 21:35, Mouse wrote:
>> My IPX won't boot because it's missing a disk label.  I can boot from
>> the installation CD but I'm not sure how to restore the disk label on
>> the disk without wiping and reinstalling everything.
>
> sunlabel(8)?  I don't know whether it's on the install CD, but if you
> extract it from the CD manually and make it available via NFS, you can
> probably boot the install CD and run it off an NFS mount.

I found it in the base.tgz file.  I managed to extract it to one of the 
other system drives but it doesn't run:

# mount /dev/sd3c /mnt2
# mount_cd9660 /dev/cd0a /mnt
# cd /mnt2; mkdir cddata ; cd cddata
# tar -xzf /mnt/sparc/binary/sets/base.tgz "./usr/sbin/sunlabel"
./usr/sbin/sunlabel

# cd /mnt2/cddata/usr/sbin/
# ./sunlabel
sh: sunlabel: not found

Not found?  It's right there unless I missed something.

AGC | 2 Dec 07:02 2011
Picon

Re: Relabel disk?

On 12/1/2011 21:35, Mouse wrote:
>> My IPX won't boot because it's missing a disk label.  I can boot from
>> the installation CD but I'm not sure how to restore the disk label on
>> the disk without wiping and reinstalling everything.
>
> sunlabel(8)?  I don't know whether it's on the install CD, but if you
> extract it from the CD manually and make it available via NFS, you can
> probably boot the install CD and run it off an NFS mount.

I found it in the base.tgz file.  I managed to extract it to one of the 
other system drives but it doesn't run:

# mount /dev/sd3c /mnt2
# mount_cd9660 /dev/cd0a /mnt
# cd /mnt2; mkdir cddata ; cd cddata
# tar -xzf /mnt/sparc/binary/sets/base.tgz "./usr/sbin/sunlabel"
./usr/sbin/sunlabel

# cd /mnt2/cddata/usr/sbin/
# ./sunlabel
sh: sunlabel: not found

Not found?  It's right there unless I missed something.

Mouse | 2 Dec 07:14 2011

Re: Relabel disk?

>> sunlabel(8)?
> I found it in the base.tgz file.  I managed to extract it to one of
> the other system drives but it doesn't run:

> # mount /dev/sd3c /mnt2
> # mount_cd9660 /dev/cd0a /mnt
> # cd /mnt2; mkdir cddata ; cd cddata
> # tar -xzf /mnt/sparc/binary/sets/base.tgz "./usr/sbin/sunlabel"
> ./usr/sbin/sunlabel
> 
> # cd /mnt2/cddata/usr/sbin/
> # ./sunlabel
> sh: sunlabel: not found

> Not found?  It's right there unless I missed something.

I don't see any ls or equivalent confirming that it is, though what you
quote certainly looks to me as though it should be.  I do note that
it's "sh: sunlabel: not found" rather than "sh: ./sunlabel: not found",
though I don't know enough to know whether that's significant.  It
strikes me that this could be a missing library; on a 5.1 machine I
have handy (I don't see anything saying what OS rev you're at) sunlabel
is linked dynamic with -ltermcap and -lutil as well as -lc, and I don't
know whether any of those are available in .so form on the install
pseudo-live-CD system.

If the disk label is the only thing that got destroyed, you should be
able to mount /dev/sd3c if your root partition begins at the beginning
of the disk.  Of course, if you split your system up into a lot of
partitions, just mounting root may not get you all that much.  (If it
(Continue reading)

Mouse | 2 Dec 06:57 2011

Re: Relabel disk?

> I'm slightly fuzzy, but disk layout is generally:

> 0: 1st-stage boot
> 1: disklabel
> 2-15: 2nd-stage boot
> 16-N: filesystem

This does not sound right, and checking reveals that it is not how the
disk is laid out on my IPX.

Rather, what I see is

- Sector 0 contains the disklabel

- Sectors 1-15 contain first-stage bootblocks

- The filesystem begins at sector 0 as far as things such as newfs are
   concerned, but it is an FFS filesystem, and FFS deliberately avoids
   using the first 16 sectors of its partition, for exactly this
   reason: to leave space for bootblocks (and, later, disklabels).

- Second-stage bootblocks, if used, are in a location that depends on
   the code in the first-stage bootblocks.  In the case of my IPX, the
   block numbers of this code are written into the first-stage booter
   when the latter is installed; I have also seen first-stage
   bootblocks that know enough FFS to read the second-stage bootstrap
   out of the filesystem.

The disklabel must be in sector 0 of the drive.  I believe the
first-stage bootblocks must be in sectors 1-15 of the boot partition;
(Continue reading)


Gmane