mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lv_manip: handle swap devices in fs-related checks for lvreduce/lvextend
This provides better hints when trying to resize the fs on top of an LV.
Also needs a3f6d2f593
for proper operation.
❯ lvs -o name,size vg/swap
lv_name lv_size
swap 60.00m
Before:
❯ lvextend -L72m vg/swap
Size of logical volume vg/swap changed from 60.00 MiB (15 extents) to 72.00 MiB (18 extents).
Logical volume vg/swap successfully resized.
❯ lvreduce -L60m vg/swap
File system swap found on vg/swap.
File system device usage is not available from libblkid.
❯ lvreduce -L50m vg/swap
Rounding size to boundary between physical extents: 52.00 MiB.
File system swap found on vg/swap.
File system device usage is not available from libblkid.
After:
❯ lvextend -L72m vg/swap
Size of logical volume vg/swap changed from 60.00 MiB (15 extents) to 72.00 MiB (18 extents).
Logical volume vg/swap successfully resized.
❯ lvreduce -L60m vg/swap
File system swap found on vg/swap.
File system size (60.00 MiB) is equal to the requested size (60.00 MiB).
File system reduce is not needed, skipping.
Size of logical volume vg/swap changed from 72.00 MiB (18 extents) to 60.00 MiB (15 extents).
Logical volume vg/swap successfully resized.
❯ lvreduce -L50m vg/swap
Rounding size to boundary between physical extents: 52.00 MiB.
File system swap found on vg/swap.
File system size (60.00 MiB) is larger than the requested size (52.00 MiB).
File system reduce is required and not supported (swap).
This commit is contained in:
parent
e009becd73
commit
5096335277
@ -6144,6 +6144,8 @@ static int _fs_reduce_allow(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
if (fsi->mounted)
|
||||
fsi->needs_unmount = 1;
|
||||
|
||||
fsi->needs_reduce = 1;
|
||||
} else if (!strcmp(fsi->fstype, "swap")) {
|
||||
fsi->needs_reduce = 1;
|
||||
} else {
|
||||
/*
|
||||
@ -6314,6 +6316,8 @@ static int _fs_extend_allow(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
if (lp->nofsck)
|
||||
fsi->needs_fsck = 0;
|
||||
|
||||
} else if (!strcmp(fsi->fstype, "swap")) {
|
||||
fsi->needs_extend = 1;
|
||||
} else if (!strcmp(fsi->fstype, "xfs")) {
|
||||
fs_extend_cmd = " xfs_growfs";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user