用livecd部署机器, livecd没有lvm软件包相关命令, 但是部署的系统里有.
所以在装了根分区后, 通过chroot到部署系统, 创建lv, 然后mke2fs格式化分区(ext4):
mke2fs -t ext4 -L /home /dev/vg_data/lv_home
Creating journal (xxx blocks): mke2fs: Can't check if filesystem is mounted due to missing mtab file while trying to create journal
/etc/mtab文件没有, 因为之前通过rsync module同步时, 这个文件在exclude列表里.
blkid可以看到, 格式化分区是失败的, 并没有这个分区.
grep -v rootfs /proc/mounts > /etc/mtab
/etc/mtab则是一个动态的文件, 显示的是当前挂载的设备, 通过
/etc/fstab是一样的. 不过第5列和第6列是无意义的, 都是0.
mtab lists currently mounted file systems and is used by the mount and unmount commands when you want to list your mounts or unmount all. It's not used by the kernel, which maintains its own list (in /proc/mounts or /proc/self/mounts). Its structure is the same as fstab (see manpage).
Separated by whitespace, its 6 columns are:
- Mount device if applicable
- Mount point
- File system
- Mount options
- Used by the dump command, 0 to ignore
- Used by the fsck command (which order to check at boot), 0 to ignore
To clarify, mtab does contain values in the 5th and 6th columns in order to have the same structure as fstab, even though these columns are only meaningful when used in fstab.
/etc/mtabfile shares the same structure as
/etc/fstab. According to this site the 5th and 6th column in
/etc/fstabare used to store "Dump and fsck options". The 5th column is used to determine if dumping of the partition should be made, and the 6th to decide if an fsck must be processed on the partition.
/etc/mtab, however, this two options loose their sense. Indeed, these two options are used when mounting the partitions, and
/etc/mtablists the partitions that are already mounted. If I understand it correctly, these option are not useful in
/etc/mtab. They may be here for compatibility reasons with
/etc/fstab, as the content of
/etc/mtabmust be directly usable in