NetBSD-Users archive

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

Re: How to create new partition from free space on a disk



    Date:        Tue, 10 Dec 2019 09:32:41 +0530
    From:        Mayuresh <mayuresh%acm.org@localhost>
    Message-ID:  <20191210040241.GA20765@localhost>

  | My disklabel looks like this. Not sure how swap got created twice.

What exactly did you add with fdisk?  And what did you do with sysinst?
That's a very odd partition layout (just odd, not incorrect).

  | Shall I be using disklabel -e 

Yes, that's what NetBSD uses - the advice to use fdisk was well
intentioned I'm sure (and it is a good idea to make sure all space
NetBSD is using is allocated that way, so that some other system
you might add later doesn't overwrite NetBSD's data) but once the
disklabel exists and can be found (which the MBR (fdisk label) is
used for) what fdisk says is irrelevant to NetBSD.   The disklabel
controls everything.

Confirm what you are using with "df" and "swapctl -l" - change that
if it looks wrong (unmount anything unwanted, turn off swap), then edit
the disklabel adding new partitions - or deleting that 'e' partition if
it isn't being used, or it is, and you disable it (swapctl -d), and you
don't want to keep it.  Verify that you don't have any overlapping partitions,
(and ideally, nothing outside the space(s) allocated to NetBSD in the MBR
(fdisk label)) and you're done.   For new partitions you can just set the
fsize bsize cpg/sgs fields (the 3 columns after "4.2BSD" - see your 'a'
partition entry) as zero (but they must be present), those will get updated
when you use "newfs" to actually make a filesystem in the partition(s)
you make.

Once you have done newfs (see newfs(8)) (on /dev/rwd0X for whatever X
(in the range e..p) you have made a partition) you can mount (see mount(8))
it, and add it to /etc/fstab (see fstab(5) - add using an editor) (or add
it first, and then you can use a simplified form of the mount command).

Don't forget to mkdir the directory where you will mount the new partition,
and make sure its owner and permissions are set sanely before you mount
(weird things happen when the mounted-upon directory setup is strange, it
is no longer accessible (to be observed, or changed) after the mount has
been done).

kre



Home | Main Index | Thread Index | Old Index