Skip to contentSkip to conversation

Swap on LVM - swapoff problem - more info

linux-lvm George Karaolides 2 participants 2 messages Apr 9, 2003

lore
Share & tools
lore
#0 lore raw

Re. the problem with swapoff returning "invalid argument" with LVM devices on a Debian woody system, I now have some more info.

The problem is caused by running vgscan while swap is active on the LVM device (not necessarily actually using swap space; just active). If after that a swapoff is attempted, swapoff returns "Invalid argument".

The lvm init script runs vgscan, and where LVM has already been activated using initrd and an LVM swap device is already activated, this breaks swapoff.

I modified the "start" case of the lvm init script to run swapoff before running vgscan, and swapon after. That solved the problem. I don't know if this will cause any other problems, but I don't think it will.

When swapping on LVM, swapoff must be run before running vgscan manually, too, or swapoff will break again.

Signature · 10 lines
Best regards,

|   George Karaolides                      Planitis Communications Ltd.,
|
|   tel:   +357 22 45 65 00              Office 102, 11 Florinis Street,
|
|   web:   www.planitis.net                             Nicosia CY 1065,
|
|   email: [email protected]           Republic  of Cyprus.
|
#1 lore raw
Quoted 5 lines · George Karaolides

The problem is caused by running vgscan while swap is active on the LVM device (not necessarily actually using swap space; just active).

I modified the "start" case of the lvm init script to run swapoff before running vgscan, and swapon after.

If you really want to experiment with swap on an LVM volume (why?) you should resequence your startup so that vgscan gets run *after* /etc is mounted but *before* setting up swap.

It's rather late running vgscan after you've *already* started up LVM. vgscan should be run to detect LVM-related disk configuration changes *before* using LVM proper.

Alasdair

Signature · 1 line
[email protected]