Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I resized with lvresize the swap from 4 to 2G and can't turn it on.

swapon /dev/VolGroup/lv_swap
swapon: /dev/VolGroup/lv_swap: swapon failed: Invalid argument

lvdisplay /dev/VolGroup/lv_swap
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_swap
  VG Name                VolGroup
  LV UUID                h7DEfK-cdVr-UzeQ-8qDJ-rAhH-ejYS-k2wyY6
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                2.06 GiB
  Current LE             66
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You need to run mkswap on that device:

# mkswap /dev/VolGroup/lv_swap

Resizing the device will not, by itself, re-prepare the device for swapping.

share|improve this answer

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.