2

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?

0

2 Answers 2

2

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!

4
  • Can I simply rewrite the fstab file? Does it have undesired consequences? Commented May 22, 2023 at 15:07
  • 1
    Well, you can (actually required!), but the data will still be in there if you don't move it over! ;-) no magic here.
    – Hannu
    Commented May 22, 2023 at 16:27
  • I don't understand you. If I mounted /dev/sda0e as /home and /dev/sd0k as /var in fstab, what would happen? Commented May 23, 2023 at 17:28
  • After swapping only the fstab entries, before moving files - $ find /home will show the files you had in /var before the swap, and vice versa.
    – Hannu
    Commented May 24, 2023 at 16:23
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .