NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: disklabel writing behavior?

from "Julian Fagir" <>

> I wonder nobody else answered, so I'll do. This is one of the usual topics
> you are always absolutely sure about, but if someone asks, you have to admit
> that you never looked at the source code and always only 'had that
> behaviour', but don't know for sure about the general case.

> So, I'll assume that the behaviour I always assumed and experienced on my
> machines is the general case (as it is the only one that would make sense).

> > How does NetBSD disklabel behave when writing a disklabel when the disk
> > involved has multiple slices/BIOS partitions?  Does the disklabel go only
> > on the NetBSD partition, or can it intrude on another partition where
> > another OS, like FreeBSD, Linux or DOS is installed?
> No, the disklabel is only written onto the slice you chose to.

Thanks for your response.  I looked at the source code but not the same 
section.  I was trying to find the one-character commands to use inside 
disklabel interface.

This is my present hard-disk partitioning, output of "fdisk -lu /dev/hda" run 
in Linux.

Disk /dev/hda: 41.1 GB, 41174138880 bytes
16 heads, 63 sectors/track, 79780 cylinders, total 80418240 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xdcc1dcc1

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1              63    16964639     8482288+  a9  NetBSD
/dev/hda2        16964640    17992799      514080   82  Linux swap
/dev/hda3        17992800    54701324    18354262+  83  Linux
Partition 3 does not end on cylinder boundary.
/dev/hda4   *    54701325    80405324    12852000   a5  FreeBSD
Partition 4 does not end on cylinder boundary.

I remember I had the FreeBSD disklabel (bsdlabel ad0s4) look just like the 
NetBSD disklabel after I had built and installed a lot of the FreeBSD ports, so 
I didn't want to lose the FreeBSD installation.  But I recovered by running 
bsdlabel with a saved copy of the FreeBSD disklabel.  Last version of NetBSD I 
had installed was 5.0.2 patch/update.  This does not happen when updating 
NetBSD from CD as opposed to a fresh install with disklabel and newfs.  I 
recently read something about this happening on emailing list.  Now I have NetBSD 
5.1_RC3 on the NetBSD partition.

I think something like this might have happened earlier when I had FreeBSD 7.2 
installed but had not added any packages/ports and couldn't boot or read that 
partition.  By the time I got to fixing it, FreeBSD 8.0 was released, so I 
installed that fresh.  It was not until I had the problem on FreeBSD 8.0 
installation that I realized what might have happened.

I can check the source code for disklabel since I downloaded and installed the 
NetBSD source: 5.1_RC3 on this hard disk and 4.0.1 on a 4 GB USB stick.  I can 
look for what happens when a disklabel is written.

Anyway, I repeat that it's always a good idea to keep a copy of the partition 
table and disklabels on a separate msdos-formatted disk, can be a floppy or USB 
stick.  One can mess up a disklabel from the installation program sysinst 
(NetBSD) or sysinstall (FreeBSD): so many ways to get confused in FreeBSD 


Home | Main Index | Thread Index | Old Index