3

After a regular openbsd installation I have this partition scheme:

# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      986M    111M    826M    12%    /
/dev/sd0k     46.4G   20.0K   44.1G     1%    /home
/dev/sd0d      3.9G    6.0K    3.7G     1%    /tmp
/dev/sd0f     11.2G    1.3G    9.4G    12%    /usr
/dev/sd0g      986M    2.0K    937M     1%    /usr/X11R6
/dev/sd0h     15.7G    151M   14.7G     1%    /usr/local
/dev/sd0j      5.8G    2.0K    5.5G     1%    /usr/obj
/dev/sd0i      2.9G    2.0K    2.8G     1%    /usr/src
/dev/sd0e     12.8G    7.8M   12.2G     1%    /var

I want to have bigger /var/ and smaller /home.

Can I swap mount points? Mounting /dev/sda0e as /home and /dev/sd0k as /var?

2 Answers2

3

Having /boot as separate partition, and possibly a separate disk mounted as /home makes more sense than a bunch of smallish partitions, as shown.

Unless you have a very specific reason for the setup; I'd say you're better off having a single /-partition only, leaving all the others as subfolders.

Did you just install, and not much customization yet? -> If Yes: Reinstall.

The easiest way to "swap" the partitions is; copy the data from either to a temporary location and delete originals, then 2 x "move the content to their new location". And last of-course; change the fstab!

Hannu
  • 10,568
1

If you swap it as-is (without copying files) then your services won't work and you won't be able to log into your home directory. After you swap your partitions in fstab you will want to reboot into single user mode and move your folders around.

After booting into single user mode (boot -s):

mount /home
mount /var
tar czf /var/home.tgz -C /home .         # copy files from /home to /var/home.tgz
rm -rf /home/*                           # clear out old home
tar cf - -C /var . | tar xpf - -C /home  # copy files from /var to /home
rm -rf /var/*                            # clear out old var
tar xpzf /home/home.tgz -C /var          # extract home.tgz to new home
rm /home/home.tgz                        # remove home.tgz
reboot
Zectbumo
  • 111