What are the benefits of putting swap into a logical volume over using direct disk access?

For example, with a fresh, default install of RHEL5 or 6, a volume group is created on the default disk along with one other small non-logical partition (for /boot). Inside the volume group, a swap space is created along with the mount point for /.

What are the benefits (if any) to having swap be inside a logical group instead of directly on the disk?


The benefits are:

  • more flexibilty if you want to change the size of swap
  • you don`t need a partition for swap

AFAIK this - once existing drawback does NOT exist any more:

  • not possible to resume from swap
  • how is it not flexible to change the size of swap by going direct to disk instead of a logical volume? I can add/delete/resize at will (and if I resize smaller (for whatever reason), I can always take that space and add it to my VG as an extension) – warren Nov 10 '11 at 23:12
  • @warren, you change change the LVM volumes while the system is live. If you didn't leave free space, on your physical devices, then you will probably need to repartition the system offline, when not using LVM. – Zoredache Nov 11 '11 at 1:16

There is very few benefits to doing this as far as I can tell. You can create more swap on demand and add it to total swap, along with setting up policies for which swap space to use when.

Many of the typical benefits of volume management do not really apply when the data you are keeping goes stale on a restart of a service or a reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.