Heya folks, some people online told me I was doing partitions wrong, but I’ve been doing it this way for years. Since I’ve been doing it for years, I could be doing it in an outdated way, so I thought I should ask.

I have separate partitions for EFI, /, swap, and /home. Am I doing it wrong? Here’s how my partition table looks like:

  • FAT32: EFI
  • BTRFS: /
  • Swap: Swap
  • Ext4: /home

I set it up this way so that if I need to reinstall Linux, I can just overwrite / while preserving /home and just keep working after a new install with very few hiccups. Someone told me there’s no reason to use multiple partitions, but several times I have needed to reinstall the OS (Linux Mint) while preserving /home so this advice makes zero sense for me. But maybe it was just explained to me wrong and I really am doing it in an outdated way. I’d like to read what you say about this though.

  • taanegl
    link
    fedilink
    32
    edit-2
    8 months ago

    Well technically, if you’re using BTRFS, you might want to check out subvolumes. Here’s my subvolume setup:

    • Subvolume 1, named @ (root subvol)
    • Subvolume 2, named @home (/home subvol)
    • Subvolume 3, named @srv (/srv subvol)
    • Subvolume 4, named @opt (/opt subvol)
    • Subvolume 5, named @swap (which is - you guessed it - the swap subvol)

    You then set up fstab to reflect each of the subvolumes, using the subvol= option. Here’s the kicker: they are all in one partition. Yes, even the swap. Though caveat, swap still has to be a swapfile, but in its own separate subvolume. Don’t ask me why, it’s just the way to do it.

    The great thing about subvolumes is that it doesn’t do any size provisioning, unless specified by the user. All subvolumes share the space available within the partition. This means you won’t have to do any soul searching when setting up the partitions regarding use of space.

    This also means that if I want to nuke and pave, I only need run a BTRFS command on my @ subvolume (which contains /usr, /share, /bin), because it won’t be touching the contents of @home, @srv, or @opt. What’s extra cool here is that I’ll lose 0% FS metadata or permission setup, since you’re technically just disassociating some blocks from a subvolume. You’re not really “formatting”… which is neat as hell.

    The only extra partitions I have is the EFI partition and an EXT4 partition for the /boot folder since I use LUKS2.

    • MambabasaOP
      link
      fedilink
      English
      138 months ago

      Thanks I think this is the answer I was looking for!

    • KiranWells
      link
      fedilink
      48 months ago

      Have you had any luck with hibernation with a BTRFS swapfile? My computer still does not start from hibernation, and I am not sure why, even though I followed the Arch wiki to set it up.

      • taanegl
        link
        fedilink
        48 months ago

        Can’t say I have. Haven’t used hibernation mode for years even. Sleep mode is just too good nowadays for me to use it, so I guess we could chalk that up to a fault of the setup.

        According to ReadTheDocs (BTRFS, swapfile) it’s possible under certain circumstances, but requires the 6.1 kernel to do it in a relatively easy way.

    • @seitanic
      link
      28 months ago

      How does that work with you’re installing a new system? Do the subvolumes just show up like partitions?

      • @Tiuku@sopuli.xyz
        link
        fedilink
        1
        edit-2
        8 months ago

        In tools like lsblk? Nope. They appear as directories, usually in the top-level subvolume, which typically isn’t mounted anywhere in the system.

        Then you just create mount entries in /etc/fstab just like you would with partitions, this time just using the subvol= option as mentioned above. I don’t know if there are any installers that do this for you. Archwiki – as usual – has good documentation on this.

        • @seitanic
          link
          3
          edit-2
          8 months ago

          So, it doesn’t sound like it would be useful for me, since the reason why I have separate partitions in the first place is so that I can re-install a distro or install a new distro without having to back up /home first.