我继承了一个 Ubuntu kvm 服务器:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
... 在启动时会给我们一个无法安装分区的错误,让我选择跳过或手动恢复。我不确定如何手动恢复?
该系统有两个 RAID 镜像的物理驱动器。
在 fstab 中,我看到以下失败的条目:
/dev/mapper/primary-data /mnt/data ext4 defaults 0 2
但是,该文件不在 /dev/mapper 中:
root@vmserver:/dev# ls -al /dev/mapper/
total 0
drwxr-xr-x 2 root root 120 May 18 11:07 .
drwxr-xr-x 18 root root 4680 May 18 11:10 ..
crw------- 1 root root 10, 236 May 18 11:07 control
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-backup -> ../dm-5
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-snap-cow -> ../dm-3
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-system -> ../dm-0
当我运行 vgdisplay 时,我可以看到当前有 4 个 LV,但只有 2 个是打开的?
--- Volume group ---
VG Name primary
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 162
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.79 TiB
PE Size 4.00 MiB
Total PE 469222
Alloc PE / Size 458476 / 1.75 TiB
Free PE / Size 10746 / 41.98 GiB
VG UUID ahmMej-0Pzn-V9Fk-0utn-q8PV-K7PU-AWxTQ1
如果我运行vgscan --mknodes
,我会得到这个输出:
root@vmserver:/dev# vgscan -v --mknodes
Wiping cache of LVM-capable devices
Wiping internal VG cache
Reading all physical volumes. This may take a while...
Finding all volume groups
Finding volume group "primary"
Found volume group "primary" using metadata type lvm2
Finding all logical volumes
The link /dev/primary/data should had been created by udev but it was not found. Falling back to direct link creation.
The link /dev/primary/snap should had been created by udev but it was not found. Falling back to direct link creation.
然后,/dev/mapper 的内容如下所示:
root@vmserver:/dev# ls -al /dev/mapper/
total 0
drwxr-xr-x 2 root root 180 May 18 11:31 .
drwxr-xr-x 18 root root 4680 May 18 11:10 ..
crw------- 1 root root 10, 236 May 18 11:07 control
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-backup -> ../dm-5
brw-rw---- 1 root disk 252, 2 May 18 11:31 primary-data
brw-rw---- 1 root disk 252, 1 May 18 11:31 primary-data-real
brw-rw---- 1 root disk 252, 4 May 18 11:31 primary-snap
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-snap-cow -> ../dm-3
lrwxrwxrwx 1 root root 7 May 18 11:07 primary-system -> ../dm-0
此时,如果我运行mount -a
,我现在可以查看挂载点 /mnt/data 处的分区。但是,这在重启后不会消失。
有人能指出正确的方向,让丢失的设备始终显示在 /dev/mapper 中吗?