lvresize --resizefs 无法正确识别调整大小请求值的问题求助
我最近在尝试缩小一个逻辑卷(以及其上的ext4文件系统),但lvresize --resizefs命令的输出让我有点困惑,想请教大家问题出在哪。
我的目标是把原本5TiB的逻辑卷缩小到2TiB,第一次执行的命令是:
lvresize --resizefs -L 2T /dev/archive/archive
得到的输出是:
File system ext4 found on archive/archive mounted at /mnt.
File system size (<4,55 TiB) is larger than the requested size (0 ).
File system reduce is required using resize2fs.
File system unmount is needed for reduce.
File system fsck will be run before reduce.
Continue with ext4 file system reduce steps: unmount, fsck, resize2fs? [y/n]:n
File system not reduced.
这里最让我担心的是这一行:File system size (<4,55 TiB) is larger than the requested size (0 )——请求的大小怎么变成0了?
更奇怪的是,我换不同的大小参数,输出里的请求大小还会莫名其妙地变:
当我用2000G替代2T时,命令是:
lvresize --resizefs -L 2000G /dev/archive/archive
输出里的请求大小变成了1.95TiB:
File system ext4 found on archive/archive mounted at /mnt.
File system size (<4,55 TiB) is larger than the requested size (1,95 TiB).
File system reduce is required using resize2fs.
File system unmount is needed for reduce.
File system fsck will be run before reduce.
Continue with ext4 file system reduce steps: unmount, fsck, resize2fs? [y/n]:n
File system not reduced.
而当我尝试设为3000G时:
lvresize --resizefs -L 3000G /dev/archive/archive
输出里的请求大小居然变成了952GiB:
File system ext4 found on archive/archive mounted at /mnt.
File system size (<4,55 TiB) is larger than the requested size (952,00 GiB).
File system reduce is required using resize2fs.
File system unmount is needed for reduce.
File system fsck will be run before reduce.
Continue with ext4 file system reduce steps: unmount, fsck, resize2fs? [y/n]:n
File system not reduced.
因为卷上还有重要数据,我不敢确认执行这些命令,怕出现数据丢失的问题。
补充一下背景:我这么做是为了从卷组里移除一块磁盘,要先用pvmove迁移物理扩展区,但前提得先缩小逻辑卷来腾出空间。我的环境是两块磁盘,各自有一个物理卷sda1和sdb1,它们组成了名为archive的卷组,卷组里的逻辑卷也叫archive,并且这个逻辑卷占用了卷组的全部空间。
我是参考LVM相关的官方文档来操作的,但现在搞不懂这是命令参数的问题还是什么其他原因,看起来不像是bug,但实在找不到头绪,希望大家能帮忙分析一下。
备注:内容来源于stack exchange,提问作者aarondiel

