所以这就是我想要实现的,
为此,我写了这个bash脚本
umount -v /home/ if [ $? -ne 0 ] then echo "Couldn't not unmount /home" exit 1 fi # delete lvremove /dev/cl/home if [ $? -ne 0 ] then echo "Couldn't delete LVM /dev/cl/home." exit 1 fi # create home lvcreate -L2G -n home cl if [ $? -ne 0 ] then echo "Couldn't create a new LVM /dev/cl/home." exit 1 fi mkfs.xfs /dev/cl/home if [ $? -ne 0 ] then echo "Couldn't create a file system for /dev/cl/home." exit 1 fi # restore home mount /dev/cl/home /home/
该脚本失败在mkfs.xfs / dev / cl / home用msg mkfs.xfs: /dev/cl/home contains a mounted filesystem ,看来lvcreate -L2G -n home cl并不真正创build一个新的逻辑卷它只是检索以前删除的逻辑卷与相同的文件系统,并挂载在同一挂载点/家庭,有什么可能的原因呢?