DEV Community

loading...

OpenBSD Manual Partitioning at Installation

nabbisen profile image Heddi Nabbisen Updated on ・2 min read

When installing OpenBSD, at the partitioning section, the installer asks which option to choose:

  1. Use (A)uto layout
  2. (E)dit auto layout
  3. Create (C)ustom layout

The first "a" is a good choice to rely on the default settings and save operation time at installation.

I sometimes, however, like to choose manual partitioning.
For example, using storage-limited virtual machines, I want to let the sizes of the specific mount points such as /var and /home as big as possible.
At such a time, "e" or "c" is also a good choice.

  • "e": Use auto layout but configure it.
  • "c": Create my own layout from the beginning.

The choices are followed by disklabel running:

We can manage partitions via these commands:

? | h                # show help
2.7G
p                    # print partitions

a [Partition Label]  # add partition
d [Partition Label]  # delete partition
z                    # delete all partitions

x                    # exit & lose changes
q                    # quit & save changes
Enter fullscreen mode Exit fullscreen mode

Today, I created OpenBSD vm image for Google Compute Engine (GCE) whose storage size is limited to 30 GBytes.
I changed mount points and their sizes like these operations:

> a a                  # add parition labeled as 'a'
offset: [64]           # just click Enter key
size: [62910476] 1.0G  # set partition size
FS type: [4.2BSD]      # just click Enter key
mount point: [none] /  # set mount point

> a b                  # add parition labeled as 'b'
offset: [2104512]      # just click Enter key
size: [60806028] 1.1G
FS type: [swap]        # just click Enter key

# skip 'c'

> a d                  # add parition labeled as 'd'

...

> p                    # check partitions in the end
> q                    # save changes and exit
Enter fullscreen mode Exit fullscreen mode

Finally, I changed the whole disk like this:

Partition Label Mount Point Before After
a / 1.0G 1.0G
b swap 1.2G 1.1G
c (unused) - -
d /tmp 1.7G 1.6G
e /var 2.7G 10.0G
f /usr 1.9G 1.6G
g /usr/X11R6 0.9G 0.3G
h /usr/local 4.0G 4.0G
i /usr/src 1.7G 1.0G
j /usr/obj 5.8G 3.0G
k /home 9.1G 6.4G
(sum) 30.0G 30.0G

Thus, I built OpenBSD on GCE and launched a small database server with its storage big enough for my usage : )

Updated:

Partition Label Mount Point Before After
a / 1.0G 0.8G
b swap 1.2G 0.8G
c (unused) - -
d /tmp 1.7G 1.4G
e /var 2.7G 2.4G
f /var/www - 7.6G
f -> g /usr 1.9G 1.6G
g -> h /usr/X11R6 0.9G 0.4G
h -> i /usr/local 4.0G 3.5G
i -> j /usr/src 1.7G 1.0G
j -> k /usr/obj 5.8G 3.0G
k -> l /home 9.1G 7.5G
(sum) 30.0G 30.0G

These assignments are also good for a tiny virtual machine when serving with using Google Cloud SQL as database : )

Discussion

pic
Editor guide