我正在开发一个分区工具,出于测试目的,我必须在环回设备上重复运行分区和 LVM 配置
- 分区
/dev/loop0
有3个分区/dev/loop0p1 /dev/loop0p2 /dev/loop0p3
- 创建LVM
pvcreate /dev/loop0p2 /dev/loop0p3
vgcreate test_vg /dev/loop0p2 /dev/loop0p3
lvcreate -L 1GB test_vg -n vol1 --wipesignature y --zero y
lvcreate -L 1GB test_vg -n vol2 --wipesignature y --zero y
partprobe /dev/loop0
经过这样的运行后,我想在同一设备上再次返回所有内容,但是,在运行分区时我收到错误
Partition(s) 2, 3 on /dev/loop0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
现在我知道解决方案是重新启动,但在开发过程中持续这样做是不合理的。有没有办法解决这个问题而不必一直重新启动?