To avoid truncating the FS, you should first shrink the VFAT volume a few hundreds (to be safe) megabytes more than wanted, then resize the LVM container and finally grow the volume to fill the LVM partition.
Besides, this question does not belong to StackOverflow but to ServerFault.
For future reference, it was only a few lines of code, using libparted. For readability, I've omitted error checking, etc. Caller is responsible for ensuring there's enough space in the partition for the new filesystem size.
发布评论
评论(3)
使用 fatresize (手册页),然后继续
lvresize
。为了避免截断 FS,您应该首先将 VFAT 卷缩小到比想要的多几百(安全起见)兆字节,然后调整 LVM 容器的大小,最后增大卷以填充 LVM 分区。
另外,这个问题不属于StackOverflow,而是属于ServerFault。
Use fatresize (manpage) and then proceed with
lvresize
.To avoid truncating the FS, you should first shrink the VFAT volume a few hundreds (to be safe) megabytes more than wanted, then resize the LVM container and finally grow the volume to fill the LVM partition.
Besides, this question does not belong to StackOverflow but to ServerFault.
没有答案+截止日期=我自己写。
为了将来参考,只有几行代码,使用 libparted。为了便于阅读,我省略了错误检查等。调用者负责确保分区中有足够的空间来容纳新的文件系统大小。
No answers + deadline to meet = write it myself.
For future reference, it was only a few lines of code, using libparted. For readability, I've omitted error checking, etc. Caller is responsible for ensuring there's enough space in the partition for the new filesystem size.
这似乎就是您想要的, http://www.gnu .org/software/parted/manual/html_chapter/parted_2.html#SEC25
This appears to be what you want, http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html#SEC25