Hi all,

So, a few years ago now, I deployed a router VM with OpenBSD 6.1 AMD64.
 Later that got updated to 6.2, then 6.3, 6.4…

Yesterday I updated it to 6.5, then 6.6… now I'm trying to run syspatch:

> sjl-router# syspatch                                                          
>                                                          
> Get/Verify syspatch66-010_libcaut... 100% 
> |********************************************************************| 20185 
> KB    00:16     
> Installing patch 010_libcauth
> No space left on sd0a, aborting
> sjl-router# df -h  
> Filesystem     Size    Used   Avail Capacity  Mounted on
> /dev/sd0a      129M   98.0M   24.4M    80%    /
> /dev/sd0k      472M   28.0K    448M     0%    /home
> /dev/sd0d      198M   76.0K    188M     0%    /tmp
> /dev/sd0f      2.3G    1.3G    911M    60%    /usr
> /dev/sd0h      2.1G    551M    1.4G    27%    /usr/local
> /dev/sd0j      1.3G    2.0K    1.2G     0%    /usr/obj
> /dev/sd0i      1.0G    2.0K    974M     0%    /usr/src
> /dev/sd0e      209M    119M   79.1M    60%    /var
> sjl-router# uname -a
> OpenBSD sjl-router.redhatters.home 6.6 GENERIC#353 amd64

8GB seemed like a reasonable amount for something that would just be
routing.  And looking at that `df` output, it would appear that there's
about 2.5GB locked away, in partitions that the original automatic
layout dictated I should have, but then didn't utilise.

I'm thankful I had the foresight of overruling its decision to allocate
space to /usr/X11R6… as this machine does not have X installed. (Why
would a router need that anyway?)

> sjl-router# disklabel sd0
> # /dev/rsd0c:
> type: SCSI
> disk: SCSI disk
> label: Block Device    
> duid: d7b965d8cdeaeef2
> flags:
> bytes/sector: 512
> sectors/track: 63
> tracks/cylinder: 255
> sectors/cylinder: 16065
> cylinders: 1044
> total sectors: 16777216
> boundstart: 64
> boundend: 16771860
> drivedata: 0 
> 
> 16 partitions:
> #                size           offset  fstype [fsize bsize   cpg]
>   a:           268416               64  4.2BSD   2048 16384  2097 # /
>   b:           373010           268480    swap                    # none
>   c:         16777216                0  unused                    
>   d:           413056           641504  4.2BSD   2048 16384  3227 # /tmp
>   e:           435744          1054560  4.2BSD   2048 16384  3390 # /var
>   f:          5006848          1490304  4.2BSD   2048 16384 12958 # /usr
>   h:          4403456          6497152  4.2BSD   2048 16384 12958 # /usr/local
>   i:          2138976         10900608  4.2BSD   2048 16384 12958 # /usr/src
>   j:          2746048         13039584  4.2BSD   2048 16384 12958 # /usr/obj
>   k:           986208         15785632  4.2BSD   2048 16384  7674 # /home

Question is, how do I re-organise this space?  There is sufficient space
there.  /usr/obj and /usr/src are pretty much unused.  /usr/local could
be made smaller too as could /home.

OpenBSD has growfs(8).  I note it is called growfs and not resizefs nor
shrinkfs.  The steps I believe I'd need to perform are:

- shrink /home to 200MB
- re-locate /home to the end
- blow away /usr/src and /usr/obj
- shrink /usr/local to 1GB
- re-locate /usr/local to just before /home
- re-locate /usr to just before /usr/local
- re-locate /var to just before /usr
- re-locate /tmp to to just before /var
- now grow / to fill the available space

In days gone by, there was PartitionMagic for doing this.  Under Linux
today, there's gparted.

OpenBSD complicates things because it ignores the native disklabel
format of the host platform (i.e. MS-DOS disklabel / GUID partition
table) in favour of its own BSD slice system.  So such a tool has to not
only understand ffs, but it also must understand the BSD disklabel
embedded in the partition allocated to OpenBSD.

Re-installing is something I did under the following conditions:
- Before the existence of the aforementioned partition management tools
- When I *really* screwed up

I'm not after a GUI tool to do this (although some sort of visualisation
is helpful in my experience, I can also use a spreadsheet to work out
the numbers), but I really don't think "reinstall" should be the default
answer to all this as that is really a measure of last resort.

Is there such a tool for manipulating partitions in this manner?
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

Reply via email to