• M-Reimer@lemmy.world
    link
    fedilink
    arrow-up
    31
    arrow-down
    1
    ·
    11 months ago

    One small /boot which is also my EFI system partition.

    And a partition for / which covers all the rest of the drive.

    Partitioning only limits flexibility. At some time you will regret your choice of partition sizes.

      • M-Reimer@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        11 months ago

        I did that years ago and then kept fiddling with the lfs subvolume sizes. I see absolutely no advantages to make things more complicated than needed.

    • kristoff@infosec.pub
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      11 months ago

      I dan’t know if this is still valid but I used to be told to have different partitions for your system, logs and data (home directories) … and have the swap-partition located in between them. This was to limit the distance the head has to move when reading from your system starts swapping.

      But if you use a SSD drive, that is not valid anymore of course :-)

      Kr.

    • Molecular0079@lemmy.world
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      11 months ago

      Nowadays you don’t even need a /boot unless you’re doing full disk encryption and I actually recommend keeping /boot on / if you’re doing BTRFS root snapshots. Being able to include your kernel images in your snapshots makes rollbacks painlessly easy.

      • mhz@lemm.ee
        link
        fedilink
        arrow-up
        6
        ·
        11 months ago

        UEFI forum made it a requirement for motherboard constructors (hp, dell, msi…) to make their UEFI implementation to be able to at least read fat(12/16/32) filesystems. That is why you need a fat(12/16/32) partition flagged ESP (efi system partition) for holding your boot files.

        So, I dont think you can do that unless you fall back to the old outdated BIOS or you have some *nix filesystem in your uefi implementation which I dont trust.

        • Molecular0079@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          11 months ago

          You’re only partially correct. /boot doesn’t have to also be your EFI partition. In fact, most distros by default will separate the two, with the EFI partition mounted at /boot/efi and /boot being a separate ext4 based partition. My suggestion is that, if you’re running BTRFS, you should merge /boot and / as one partition. You’re still free to have a FAT32-based EFI mounted at /boot/efi or better yet /efi.

          • yum13241@lemm.ee
            link
            fedilink
            arrow-up
            1
            ·
            11 months ago

            I use systemd-boot and my mount point is /efi. /efi/EFI/ is where my bootloaders live.

            If I rollback to an old enough snapshot, I have to reinstall my kernels from a chroot. It’d be cool if I could get around that.

    • mhz@lemm.ee
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      11 months ago

      That is why one small (512Mib) ESP and one BTRFS partition occupying the rest of my drive is my go, I can isolate the root (/), var and home partitions using subvolumes.

      Users who distro hope may need a separate /home partition.

    • library_napper@monyet.cc
      link
      fedilink
      arrow-up
      4
      arrow-down
      10
      ·
      11 months ago

      Aaaand your server just crashed because of a spammy log. You lost the company $222 million overnight, the database is corrupt, and every 9 minutes the company looses another $1 million.

      Good job.

  • Andrius Štikonas@lemmy.kde.social
    link
    fedilink
    arrow-up
    23
    ·
    11 months ago

    It really depends on your requirements…

    But a few useful points:

    1. Use GPT partition table and not MBR. Everything will be simpler, no need for extended/logical partitions.
    2. If you need to be able to do online (mounted) partition resizing, pick btrfs. Ext4 can only grow them online but not shrink.
    3. Make sure your partition boundaries are 1 MiB aligned.
    4. If you need more advanced setups, consider using LVM.
    • db2@sopuli.xyz
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      11 months ago

      About lvm though, experiment with it before jumping in with your daily driver.

      • Andrius Štikonas@lemmy.kde.social
        link
        fedilink
        arrow-up
        3
        ·
        11 months ago

        Indeed, it’s a bit more complex setup, you won’t be able to boot without initramfs. But in certain cases (e.g. encryption or partitions spanning multiple devices) it is very useful.

        • The Doctor@beehaw.org
          link
          fedilink
          arrow-up
          1
          ·
          11 months ago

          A lot of distros default to booting with an initramfs or initrd by default, anyway. If only because you can set up an encrypted drive at installation time, so may as well have it but not need it rather than the reverse.

  • dack@lemmy.world
    link
    fedilink
    arrow-up
    18
    ·
    11 months ago

    1Gb EFI, rest of the disk LUKS with a single BTRFS inside. Use BTRFS subvols to divide things up. Swap as a swap file on BTRFS (be sure to set it as no_cow).

    • Eufalconimorph@discuss.tchncs.de
      link
      fedilink
      arrow-up
      2
      ·
      11 months ago

      Same, except ZFS instead of BTRFS for me.

      And / is tmpfs, /home is tmpfs, /nix, /etc/nixos, /var/log, /home/$username/downloads, /home/$username/documents, and some other directories are ZFS subvolumes bind-mounted at boot. That’s only an option for NixOS or Guix though, so don’t worry about opt-in state on other distros.

    • chayleaf@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      11 months ago

      I prefer a very small EFI partition mounted at /boot/efi, that way the kernels and initrds sit at /boot alongside the rest ot the files (though if you also want encryption you need to add your encryption keys to initrd so you don’t have to enter the password twice)

      • lloram239@feddit.de
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        11 months ago

        Some distributions (e.g. NixOS) store their kernels on the EFI partition, going small will bite you on those. 1GB is a good size. The Windows default of 100MB is only enough to store two kernels.

        Edit: This might actually be systemd-boot specific.

        • heartlessevil@lemmy.one
          link
          fedilink
          English
          arrow-up
          2
          ·
          11 months ago

          This is true. I used a 1gb boot partition on my Nixos install and every time I update it I need to delete all the old kernels/initrd and sometimes I even delete the one that’s currently running.

        • chayleaf@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          11 months ago

          I use NixOS, and read my comment again. /boot/efi is only for GRUB. /boot is where the actual kernels reside, and it isn’t on the EFI partition.

          • lloram239@feddit.de
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            11 months ago

            Might actually be systemd-boot thing, not a NixOS specific thing, either way, this is where my kernels are:

            /boot/EFI/nixos/vnmrdbd7a5rg6482d6p8zxc57xf2nxqb-linux-6.1.44-bzImage.efi

            /boot is straight up the EFI partition, there is no separate /boot partition.

      • devfuuu@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        11 months ago

        In many of my laptop setups I’ve also solidified around similar setup: 200 or 500 mb efi + luks with lvm with root and home volumes. Swap is a file which makes everything easy without having to care about another partition and is automatically encrypted since it stays on root.

        Partition formats is always ext4 since there’s no need for anything else. Tried btrfs in the past and it had problems, more than it solved, and xfs years ago regularly had problems corrupting files when power went off. I swore on never using any of those 2 again.

  • buwho@lemmy.ml
    link
    fedilink
    English
    arrow-up
    14
    ·
    11 months ago

    i usually have efi boot partition (512mb), / (linux root), /home (i usually make this pretty big) , and swap partition.

    • vettnerk@lemmy.ml
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      11 months ago

      Same, except I also keep /var on a separate partition (old FreeBSD habit), as the I/O characteristics of /var are usually very different from rest of /

    • Papamousse@beehaw.org
      link
      fedilink
      English
      arrow-up
      5
      ·
      11 months ago

      Same: EFI, then / is small like 50GB, and home is the remaining of disk. My swap is the size of RAM so I could hibernate but in fact never use it really, as my system either sleep or if shutdowned, can boot in a few seconds. You cannot go wrong with the setup from @[email protected].

      There was a time when I had (and we needed) complicated partition… one for / really small like a few MB, and basically one for bin, etc, var, use, home, tmp (not a lot of RAM at the time so tmp was on disk, not in ram) etc.

  • PeterPoopshit@lemmy.ml
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    11 months ago

    Usually, I do the simplest thing: all the stuff goes on one big ext4 partition. I don’t make a separate partition for /home. I’ll make a swap partition if I can remember but I’ve forgotten to do that before and nothing bad happened. The bootloader goes on a fat32 /boot/efi on the same drive as whatever the Linux install is on. This way I can swap around the drive to different pcs if I have to or easily change/upgrade drives without having to reinstall all my stuff.

    This strategy works for dual booting Windows also. I’ll put the windows install all on its own separate drive so it won’t try to erase grub during a disk check or something. That happened one time. Also, by putting Windows and Linux on separate drives you can use the bios to boot between Windows or Linux if you mess up one of the bootloaders.

    • Goatastic@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      The two drives thing is an interesting strategy. I might look into implementing that. Thinking of switching to an arch based Linux from debian.

  • circuitfarmer@lemmy.sdf.org
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    edit-2
    11 months ago

    I think you’re going to get a wide variety of responses here. It comes down to a lot of factors.

    For me personally, I’ve been shifting everything I have to Btrfs, so I can tell you what I’ve done recently and why.

    A big caveat is that many of my systems have multiple physical drives. This means I’m often setting things up based on the speed and capacity of those disks.

    But, I do have one system with a single drive shared for booting, root, and home. It’s set up like this:

    1. A FAT32 partition for /boot. 512 MB.

    2. A single Btrfs partition across the rest of the drive.

    3. Btrfs subvolumes: @ mounted at /, @home mounted at /home. @snapshots mounted at /.snapshots.

    I could go crazy with other subvols (e.g. for /var/log), but ultimately it is sufficient for me to be able to snapshot / and /home separately.

    For some of my other systems, I’ll have / and /home on different drives. In that case, each has their own @snapshots with their own mount point. I tend still to throw the EFI boot partition mounted at /boot on the same drive as /.

    It’s very easy to simply change /etc/fstab as needed and point to another snapshot, effectively rolling back the drive to some former point as necessary.

    • zwekihoyy@lemmy.ml
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      11 months ago

      I’ve had some wild issues that I can’t even begin to explain with btrfs. I landed on using xfs for / partition and btrfs on /home

      • circuitfarmer@lemmy.sdf.org
        link
        fedilink
        arrow-up
        4
        ·
        11 months ago

        Fair, I’ve not had any issues but I’m sure they exist. One or the other is faster based on workload, too, so it’s not really that one is objectively better all the time.

        • zwekihoyy@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          11 months ago

          tbh I’m pretty sure the issue I ran into was user error anyways, but once I finally figured out what I was doing, I decided to land on xfs for root and btrfs for home for the following reasons.

          1. xfs is supposedly more performant and common in data centers
          2. having a separate partition mounted at /home allows for os reinstalls or even distro swaps while retaining my home directory contents (assuming my user is the same)
          3. most of the contents I want backed up are held in /home. I don’t want snapshots of my entire system laying around
          4. I like being extra
        • mygreatlimbo@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          11 months ago

          I’m sure a lot of them existed 10 years ago but today it is a really good FS. I’m using btrfs on my server and laptop for a few years and had 0 issues. Today’s opinions on largly btrfs base on bugs and FUD from the past which is a shame.

          Except RAID5 and 6. Don’t use them with btrfs :)

  • cizra@lemm.ee
    link
    fedilink
    arrow-up
    7
    ·
    11 months ago

    Not saying my practice is the best one, but here’s what I do:

    • EFI system partition is mounted on /boot
      • kernel is held here. In case of distros like NixOS etc that keep around old kernels, a small ESP might run out of space. I make mine at least 1GB.
    • the rest of the disk is one luks2 volume
    • inside the encrypted volume, there’s a BTRFS volume
    • there’s a subvolume for /home
    • and a subvolume for every distro I have (which is usually 1, but sometimes I tinker or switch)
    • Kernel command line parameters specify the btrfs subvol with the right distro to boot.
    • for NixOS, you need a bootloader (to choose the right kernel). Systemd-boot works well, and its configuration is easily readable. I never figured out how to work with GRUB2, its configuration is just too confusing.
    • or if you like Arch, dispense with bootloaders and just use EFISTUB. You can put kernel cmdline params into EFI bootloader options with efibootmgr.

    Simple yet complete. Efficient, and extensible - for example, now that everything is a subvolume, I can easily snapshot it, then create backups with rsync off the snapshot, to avoid inconsistent state between backed-up files.

  • neo@lemmy.comfysnug.space
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    11 months ago
    • 500mb-600mb fat32 /boot partition
    • 40gb - 100gb ext4 or btrfs / partition (if you know you’re gonna install a lot of software, go bigger)
    • 1x - 2x ram as swap
    • rest of disk as ext4 /home partition
    • Tb0n3@sh.itjust.works
      link
      fedilink
      arrow-up
      6
      arrow-down
      2
      ·
      11 months ago

      I haven’t had swap since I started using 32GB of ram and I’ve been fine. Might be worthwhile to use LVM for a more adjustable partitioning just in case. I made the mistake of making root 50G and I’ve been fighting with it for a while.

        • devfuuu@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          11 months ago

          Yeah, 32g is barely enough for what I do daily at work, so I have similar amount of ram combined with similar amount of swap file so I can safely hibernate even when the ram is full.

  • Decipher0771@lemmy.ca
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    11 months ago

    Depends on your system. Desktop have different requirements than servers.

    On both at minimum, I’d keep /home and /var/log separate. Those usually see the most writes, are least controlled, and so long as they’re separate partitions they can fill up accidentally and your system should still remain functional. /tmp and /var/tmp should usually be mounted separately, for similar reasons.

    /boot usually keep separate because bootloaders don’t always understand the every weird filesystem you might use elsewhere. It would also be the one unencrypted partition you need to boot off of.

    On a server, /opt and /srv would usually be separate, usually separate volumes for each directory within those as well, depending how you want to isolate each application/data store location. You could just use quotas; but mounting separately would also allow you to specify different flags, i.e. noexec, nosuid for volumes that should only ever contain data.

    /var/lib/docker and other stuff in /var/lib I usually like to keep on separate mounts. i.e. put /var/lib/mysql or other databases on a separate faster disk, use a different file system maybe, and again different mount options. In distant past, you’d mount /var/spool on a different filesystem with more inodes than usual.

    Highly secure systems usually require /var/log/audit to be separate, and needs to have enough space guaranteed that it won’t ever run out of space and lock the system out due to inability to audit log.

    Bottom line is its differnet depending on your requiremtns, but splitting unnecessarily is a good way to waste space and nothing else. Separate only if you need it on a different type of device, different mount options, different size guarantees etc, don’t do it for no reason.

    • Andrius Štikonas@lemmy.kde.social
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      Regarding /boot, it can be encrypted as long as your bootloader can decrypt it, for example GRUB can decrypt LUKS encrypted partitions (albeit somewhat slowly). And the only partition that really has to be unencrypted is UEFI system partition (ESP), where bootloaders are located.

  • mrvictory1@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    11 months ago
    • 1 GiB FAT32 EFI, rest in your preferred filesystem for root
    • If you are dualbooting and accessing all files / games from Windows is a concern, make Linux root partition around 50 GiB
    • I use zram instead of swapfile or partition but setting up zswap (NOT zram) with swapfile is a better idea.
    • You didn’t mention encryption. Are you considering it?
  • Chewy@discuss.tchncs.de
    link
    fedilink
    arrow-up
    3
    ·
    11 months ago

    Use zram instead of a SWAP partititon. Zram compresses and keeps in RAM. It’s default on Fedora and a few others iirc.

  • virr@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    Depends on environment.

    Real hardware separate for a server partitions for: /home, /var, swap, sometimes /usr, sometimes /var/log/audit Depends on deployment requirements, and if a system is expected to run after filling up audit.

    Real hardware for a at home desktop: /var, swap, maybe /home, or just one partition for / and one for swap.

    Cloud: all one partition, put swap in a file if it is needed. Cloud images are easy to grow if it is just one partition. Cloud-init will handle that automatically with the right packages installed, no configuration needed. Swap partitions are unlikely to be the right size as they vary according to memory and memory varies according to instance/guest sizes. Swap makes auto growing root partition harder (cloud-init custom config injection required). Best practice is to size workload and instances to not need swap whenever possible.

  • Heavybell@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    11 months ago

    I personally have a tiny fat32 EFI partition, a small ext4 root, and everything else allocated to LVM2. Then LVs for every large path, like /home, /var, etc. I leave most of the extents unallocated until I need more space.