Subject: Re: newfs trashes MBR/disklabel?
To: David Laight <email@example.com>
From: Dieter <firstname.lastname@example.org>
Date: 08/28/2005 14:05:34
> > For me, /usr is the partition that runs out of space when installing
> > all those bloated packages.
> I don't run separate / and /usr - after all /usr used to be what /home is,
> /usr/[s]bin only appeared becuase disks werem't big enough.
> /tmp and /var (including /var/tmp) tend to sit in /
I run a small / partition, so that there is a smaller mess when you get
the dreaded "run fsck manually", and less chance of getting one on / in
the first place. I usually run /usr read-only, which makes it far less
likely to get scrambled. Then I have /var, /home, usually at least 2
partitions for data, one mounted read-write and the rest with stuff
that doesn't change often mounted read-only. A read-only partition and
a couple of read-write partitions for the chroot prisons. And so on.
> > Ah ha! I figured that newfs must have overwritten something, but it wasn't
> > obvious what, since I had left sectors 0-62 for MBR. Thank you.
> sysinst doesn't (yet maybe) create disklabel partitions for mbr partitions
> you create inside sysinst. However if teh disk doesn't have a netbsd
> disklabel, the default label will contain entries for the mbe partitions.
IIRC, I think what happened is it only created disklabel partitions for root and
swap and put them inside the first mbr partition. So then I spent an obscene
amount of time editing in all my partitions, then having to back out a couple
from the middle when it disallowed anything above p. Since I was doing this
by hand and didn't know about leaving 63 sectors for each extended mbr
partition, the disklabel numbers didn't match the mbr numbers. So then
running newfs wrote over the extended mbr partition table info in the magic
Next time I'll try running fdisk by hand, followed by mbrlabel.
> > One more partition question. Why does port-amd64 need to waste a partition
> > for "netbsd" (partition c)? Port-alpha only wastes one partition (for "whole
> > disk", partition c on Alpha, partition d on amd64) so it would appear that
> > NetBSD doesn't need it for anything. Would anything bad happen if I used
> > partition c for a filesystem?
> You can't use 'c' for anything, the only thing I know it is used for is the
> check against writing the disklabel sector.
> The big problem arises if you take a disk from another (non-mbr) system
> and put it into an i386 (etc) one. The disk has a nice 'd' partition
> containing data - which you just can't access. One possibility is to
> swap c and d! So 'd' is still the whole disk, but 'c' is the partition
> that is 'd' elsewhere!
So, it sounds like I could use c for a filesystem, providing that it
starts at the beginning of a NetBSD mbr partition so that it will
protect the disklabel sector.