Lvm
LVM 無法檢測到我的交換或“/”卷組,但為什麼交換仍然存在
我有一台伺服器(執行 OEL/RHEL5 的 HP x86 刀片伺服器),它在 lvm.conf 中配置了錯誤的 lvm 過濾器
filter = ["a|^/dev/emcpower.*|", "r/.*/"]
我們還使用 cciss 設備,因此在 /dev/cciss 中應該有一個接受聲明。到目前為止,這種疏忽還沒有造成問題。“系統”分區(例如/var、/home 等)不在卷組中,而只是在磁碟上。
但是“/”掛載和交換空間都配置在 LVM 卷組上,而 cciss 設備上的物理卷被 lvm 過濾器拒絕。
伺服器似乎工作正常,但這怎麼可能?
掛載輸出
/dev/mapper/VolGroup01-LogVol00 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/cciss/c0d0p8 on /home type ext3 (rw) /dev/cciss/c0d0p7 on /opt type ext3 (rw) /dev/cciss/c0d0p6 on /var type ext3 (rw) /dev/cciss/c0d0p5 on /tmp type ext3 (rw) /dev/cciss/c0d0p3 on /usr type ext3 (rw) /dev/cciss/c0d0p2 on /temp type ext3 (rw) /dev/cciss/c0d0p1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) nfsd on /proc/fs/nfsd type nfsd (rw)
從 /etc/fstab
/dev/VolGroup01/LogVol00 / ext3 defaults 1 1 LABEL=/home /home ext3 defaults 1 2 LABEL=/opt /opt ext3 defaults 1 2 LABEL=/var /var ext3 defaults 1 2 LABEL=/tmp /tmp ext3 defaults 1 2 LABEL=/usr /usr ext3 defaults 1 2 LABEL=/temp /temp ext3 defaults 1 2 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/VolGroup01/LogVol01 swap swap defaults 0 0 /dev/VolGroup01/LogVol02 swap swap defaults 0 0 ...
按標籤的磁碟
[user@host~]$ ls -al /dev/disk/by-label/ total 0 drwxr-xr-x 2 root root 180 Apr 12 19:23 . drwxr-xr-x 6 root root 120 Apr 12 19:23 .. lrwxrwxrwx 1 root root 18 Apr 12 19:23 boot -> ../../cciss/c0d0p1 lrwxrwxrwx 1 root root 18 Apr 12 19:23 home -> ../../cciss/c0d0p8 lrwxrwxrwx 1 root root 18 Apr 12 19:23 opt -> ../../cciss/c0d0p7 lrwxrwxrwx 1 root root 18 Apr 12 19:23 temp -> ../../cciss/c0d0p2 lrwxrwxrwx 1 root root 18 Apr 12 19:23 tmp -> ../../cciss/c0d0p5 lrwxrwxrwx 1 root root 18 Apr 12 19:23 usr -> ../../cciss/c0d0p3 lrwxrwxrwx 1 root root 18 Apr 12 19:23 var -> ../../cciss/c0d0p6
顯示器
[user@host ~]$ sudo vgdisplay -v VolGroup01 Using volume group(s) on command line Finding volume group "VolGroup01" Wiping cache of LVM-capable devices Volume group "VolGroup01" not found
開發映射器
[user@host ~]$ ls -al /dev/mapper/VolGroup0* brw------- 1 root root 253, 0 Apr 12 19:23 /dev/mapper/VolGroup01-LogVol00 brw------- 1 root root 253, 1 Apr 12 19:23 /dev/mapper/VolGroup01-LogVol01 brw------- 1 root root 253, 2 Apr 12 19:23 /dev/mapper/VolGroup01-LogVol02
交換
[user@host ~]$ swapon -s Filename Type Size Used Priority /dev/mapper/VolGroup01-LogVol01 partition 18481144 1860804-1 /dev/mapper/VolGroup01-LogVol02 partition 18874360 0 -2
/etc/lvm/backup/VolGroup01
VolGroup01 { id = "KtRbKi-wZ8l-rsgg-LyoT-edcO-2Nzo-qsDmaK" seqno = 4 status = ["RESIZEABLE", "READ", "WRITE"] flags = [] extent_size = 65536 # 32 Megabytes max_lv = 0 max_pv = 0 physical_volumes { pv0 { id = "H9ludV-lTJK-ivK1-HcUf-G8KR-krD9-TsNJrp" device = "/dev/cciss/c0d0p9" # Hint only status = ["ALLOCATABLE"] flags = [] dev_size = 93964122 # 44.8056 Gigabytes pe_start = 384 pe_count = 1433 # 44.7812 Gigabytes } } logical_volumes { LogVol00 { id = "1P5pnt-jFXu-ec4f-NfWC-q9jx-CRGc-33lyPd" status = ["READ", "WRITE", "VISIBLE"] flags = [] segment_count = 1 segment1 { start_extent = 0 extent_count = 125 # 3.90625 Gigabytes type = "striped" stripe_count = 1 # linear stripes = [ "pv0", 0 ] } } LogVol01 { id = "dvqggw-JflJ-KC9Y-QEhw-pejq-GgIv-taDNzj" status = ["READ", "WRITE", "VISIBLE"] flags = [] segment_count = 1 segment1 { start_extent = 0 extent_count = 564 # 17.625 Gigabytes type = "striped" stripe_count = 1 # linear stripes = [ "pv0", 125 ] } } LogVol02 { id = "ZDTUSD-ItMw-xxBK-l1Le-DYX7-J4i3-UYKN4Q" status = ["READ", "WRITE", "VISIBLE"] flags = [] segment_count = 1 segment1 { start_extent = 0 extent_count = 576 # 18 Gigabytes type = "striped" stripe_count = 1 # linear stripes = [ "pv0", 689 ] } } } }
LV 仍然在啟動時掛載,因為 initrd 有一個較舊的 lvm.conf 沒有故障過濾器。新過濾器將阻止 LVM 命令工作,但不會破壞已掛載的 LV。
當您更新核心時,initrd 將使用您目前的 lvm.conf 進行更新,因此請確保在此之前修復過濾器。