[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Recommendation on partition sizes



Hi,

On Sun, Nov 04, 2018 at 03:20:11AM +0000, D&P Dimov wrote:
> does this seem like an adequate space allocation:

You're probably going to receive as many different opinions as there
are different people responding, but my recommendation in nearly any
situation is to have a reasonable /boot and swap and then the rest
of the space inside an LVM volume group.

Out of the volume group I'd initially carve only a couple of logical
volumes depending on the intended use of the machine, and I'd keep
them fairly small, because enlarging them later will be simple and
can generally be done online.

This gives you flexibility to respond to how your intended use of
the system changes over time, as very little is set in stone at the
beginning.

> boot partition, not encrypted, 1.5 GB

A little large, but not stupidly so. It's rare for any of my systems
to use more than a couple of hundred MiB in /boot.

> / root, encrypted, 40 GB 

Seems excessive. Without service-specific data or /var, my servers
generally use under 2GiB for /, so dedicating 40GiB to it is likely
to be wasteful.

> /swap, encrypted, 16GB (same as RAM)

Hugely overkill. You do not need for your swap to be as large as
your RAM unless you are intending to hibernate to disk. If you are
intending to do that, fair enough, but if not, that's probably 12+
GiB of expensive SSD that sits idle forever.

If you ever got to the point were anything like double figures GiB
of swap space is used for running processes, then it is likely that
your system would be performing like a dog and you'd want to get out
of that state as quickly as you could.

There are exceptions to that, but for those times you can simply
create a swap file and add it. There is no performance difference
between a swap file and a dedicated swap partition.

"How much swap do I require?" is a little bit of a holy war, with
some even taking the position that the answer is "zero". Unless
planning for hibernation though, "16 GiB" is not a sensible answer
in my opinion.

I'd go no higher than 2GiB regardless of RAM.

> /home, encrypted, contains the virtual Windows 10 and documents, the remaining approximately 454 GB

The problem with this plan is that should any other part of your
system run out of space, you're going to have to start putting
things under /home (or re-partition). While that will work, it will
be messy and counter-intuitive.

You may also decide later that you wish to separate the storage for
your virtual machines from your home directory and documents.

Finally, although your virtual machines initially might be fine
using image files, at some point you may want to dedicate logical
volumes to each VM.

So, if I were you, I'd be doing something like:

- 512MiB /boot
- 2 GiB swap, or 16GiB if you intend to use it as a hibernate device
- Rest as LVM volume group
    - 4 GiB / as logical volume
    - 4 GiB /var as logical volume
    - 50GiB (or whatever satisfies initial demand) /home as logical
      volume

If you suddenly find yourself needing something extra, you can
easily create a new logical volume and mount it. When you get close
to filling your /home, you can just grow it a bit and grow the
filesystem online¹.

I would want to be putting all of this on top of software RAID, so
my system doesn't die when one of the storage devices dies. So, for
example, given two identical drives sda and sdb, /boot and swap
would actually be on RAID-1 mirrors of pairs of partitions
(sd{a,b}1, sd{a,b}2 respectively).

You mentioned encryption, and the good news is that all of the above
can be done from the Debian installer with everything except /boot
encrypted. The encrypted container will be an LVM volume group, and
in manual partitioning just ensure that it does not immediately
dedicate all the space in the VG to logical volumes, so you can add
and grow your own LVs later.

Grub bootloader does understand LVM now so you could also put /boot
inside LVM, but for my tastes it is too much added complexity for
the sake of a such a small partition, so I prefer not to.

If you've never used LVM before then all of this may seem like
unwanted complexity, but it's a small set of self-contained concepts
that are very well supported by the Debian installer so to me it's
well worth getting to grips with. It will provide you with a lot of
flexibility throughout the life of the system.

Cheers,
Andy

¹ Something like:

  # lvresize -r -L+5g /dev/my_vg/home_lv

  The -r does an online grow of the filesystem as well. If you
  wanted to do those steps separately for some reason then drop the
  -r and afterwards do something like:

  # resize2fs -p /dev/my_vg/home_lv

  (Assuming ext filesystem; other filesystems have their own resize
  commands.)

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: