[clug] Suggestions on Partitions and Mounts for Solid State Disk Drive

Andrew Janke a.janke at gmail.com
Sun Mar 26 09:52:20 UTC 2017

On 26 March 2017 at 18:35, Andrew Steele via linux
<linux at lists.samba.org> wrote:
> I'll bite. :-)


> As there a reason you're wanting to use plain partitions rather than using
> LVM?
> Generally, I'd have a smallish /boot partition on sda1, then sda2 would be
> the rest of the disk as a PV. Then all the various mounts would be LVs
> which can be easily resized as the need arises.

In a similar fashion to the advice of LVM have you considered running
file based swap in order to reduce the number of partitions?

I changed to this many years ago due to needs of {in,de}creasing swap
on the fly. At the time it was on 500+ core linux clusters that were
running variable size jobs. Since then I've also started doing this on
laptops/desktops, the installer will gripe about no swap partition but
just ignore that. There is no noticeable speed penalty in all the
testing we've done, recipe for doing this is below:

# 4GB file based swap
dd if=/dev/zero of=/4GB-swap-00 bs=1M count=4096
mkswap /4GB-swap-00
swapon /4GB-swap-00

echo >> /etc/fstab
echo "# Swap file" >> /etc/fstab
echo "/4GB-swap-00  none  swap  sw  0 0" >> /etc/fstab

Note that when doing this you can have multiple swap files and just
add/remove them as you choose, you can even mix/match swap
partitions and files. If you are cautious you can flush the
file cache before adding/removing:

# to clear file cache (if you want)
echo 3 > /proc/sys/vm/drop_caches
echo 0 > /proc/sys/vm/drop_caches

I myself typically don't run LVM and only run with two partitions on both
clusters and desktops/laptops, / and /tmp with TMPDIR set to /tmp.
Makes for simple management, home dirs and data are all via NFS
or on a separate disk. The only time I run a separate /boot partition is
to get around storage driver issues.

I'm surprised that the major distros don't use swap files over
partitions, it makes the install simpler.


More information about the linux mailing list