我使用 lvresize 将交换区大小从 4G 调整为 2G,但无法打开它。
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
答案1
您需要mkswap
在该设备上运行:
# mkswap /dev/VolGroup/lv_swap
调整设备大小本身不会重新准备设备以进行交换。