Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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
share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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