![Linux Mdadm + LVM 恢复](https://linux22.com/image/526166/Linux%20Mdadm%20%2B%20LVM%20%E6%81%A2%E5%A4%8D.png)
我最近重新安装了 Ubuntu 服务器 10.04,但在重新激活包含所有非关键数据的 LVM 分区时遇到了问题。、、/dev/sda
和都组装成一个 Raid-5 阵列,上面有一个带LG 的VG (我想是的;我以前能够用手动安装它)。我目前的问题是,我无法让系统检测到 VG 并激活它。不到 20 分钟前,它还运行正常(我在上次启动时遇到过这个问题,但没有记下上次启动系统时实际激活 VG 所采取的步骤)。/dev/sdb
/dev/sdc
/dev/sdd
/dev/md0
media
part1
vgchange -ay media && mount /dev/mapper/media-part1
团队组装得很好,也很干净,但我无法让 VG 显示或安装。pvck /dev/md0
显示:
Device /dev/md0 not found (or ignored by filtering).
我的过滤器/etc/lvm/lvm.conf
是filter = [ "a/.*/" ]
pvck /dev/md0p1
显示:
Could not find LVM label on /dev/md0p1
pvdisplay
产生以下输出:
Setting global/locking_type to 1 Setting global/wait_for_locks to 1 File-based locking selected. Setting global/locking_dir to /var/lock/lvm Locking /var/lock/lvm/P_global RB Scanning for physical volume names /dev/ram0: No label detected /dev/md0p1: Label for sector 1 found at sector 0 - ignoring /dev/md0p1: No label detected /dev/ram1: No label detected /dev/sda1: Label for sector 1 found at sector 0 - ignoring /dev/sda1: No label detected /dev/ram2: No label detected /dev/ram3: No label detected /dev/ram4: No label detected /dev/ram5: No label detected /dev/ram6: No label detected /dev/ram7: No label detected /dev/ram8: No label detected /dev/ram9: No label detected /dev/ram10: No label detected /dev/ram11: No label detected /dev/ram12: No label detected /dev/ram13: No label detected /dev/ram14: No label detected /dev/ram15: No label detected /dev/sdb1: No label detected /dev/sde1: No label detected /dev/sdf1: No label detected /dev/sdg1: No label detected /dev/sdh1: No label detected /dev/sdi1: No label detected /dev/root: No label detected /dev/sdj3: No label detected /dev/sdj4: No label detected /dev/sdj5: No label detected /dev/sdj6: No label detected Unlocking /var/lock/lvm/P_global
/dev/m0p1
是 PV 应该存储的位置,但它没有显示。遗憾的是,我没有/etc/lvm/backup
之前安装的目录。
我很确定数据都在那里,我只需要知道
a)我如何强制 lvm 在/dev/md0
设备上搜索卷组,以及
b)我该如何修复此问题,以便系统在启动时检测并激活卷组(RAID 阵列在启动时已经组装)。
我不确定我是否完全理解 LVM 在物理设备上的具体位置,因此如果我的术语出现混淆,请纠正它。(PV 是物理设备,VG 位于一个或多个 PV 之上,并且 VG 中有一个或多个 LV,有点像传统硬盘中的分区?)
我当前的 lvm.conf(由 提供lvm dumpconf
)是:
devices { dir="/dev" scan="/dev/disk" preferred_names=[] filter="a/.*/" cache_dir="/etc/lvm/cache" cache_file_prefix="" write_cache_state=1 sysfs_scan=1 md_component_detection=1 md_chunk_alignment=1 data_alignment_detection=1 data_alignment=0 data_alignment_offset_detection=1 ignore_suspended_devices=0 } dmeventd { mirror_library="libdevmapper-event-lvm2mirror.so" snapshot_library="libdevmapper-event-lvm2snapshot.so" } activation { udev_sync=1 missing_stripe_filler="error" reserved_stack=256 reserved_memory=8192 process_priority=-18 mirror_region_size=512 readahead="auto" mirror_log_fault_policy="allocate" mirror_device_fault_policy="remove" } global { umask=63 test=0 units="h" si_unit_consistency=1 activation=1 proc="/proc" locking_type=1 wait_for_locks=1 fallback_to_clustered_locking=1 fallback_to_local_locking=1 locking_dir="/var/lock/lvm" prioritise_write_locks=1 } shell { history_size=100 } backup { backup=1 backup_dir="/etc/lvm/backup" archive=1 archive_dir="/etc/lvm/archive" retain_min=10 retain_days=30 } log { verbose=0 syslog=1 overwrite=0 level=0 indent=1 command_names=0 prefix=" " }
编辑:看来 LVM 拒绝扫描 MD 设备。
dandroid@tinuvael:/etc/lvm$ sudo vgcfgrestore --test --verbose media Test mode: Metadata will NOT be updated. Wiping cache of LVM-capable devices Couldn't find device with uuid 'iTmyql-LYQv-N1GD-6aM0-BHco-uHEe-taHhBI'. Cannot restore Volume Group media with 1 PVs marked as missing. Restore failed. Test mode: Wiping internal cache Wiping internal VG cache
dandroid@tinuvael:/etc/lvm$ sudo blkid
/dev/md0: UUID="iTmyql-LYQv-N1GD-6aM0-BHco-uHEe-taHhBI" TYPE="LVM2_member"
/dev/sdc: UUID="b81c877f-6542-d03b-4e08-ceb6032f5cfe" TYPE="linux_raid_member"
/dev/sdd: UUID="b81c877f-6542-d03b-4e08-ceb6032f5cfe" TYPE="linux_raid_member"
我已经修剪了几行不相关的内容,但上面显示 raid 阵列已安装并且具有 LVM 正在搜索的 UUID,但在添加到types = [ "md", 16 ]
我的配置后它仍然继续忽略该设备。
答案1
事实证明,驱动器上添加了分区表(可能是我在捣鼓并试图让 BIOS 在启动时引导正确的驱动器时添加的),而 LVM 绝对拒绝查看包含分区表的设备。使用 清空分区表后fdisk
,LVM 完美地检测到了卷组。