今天工程側(cè)的兄弟反饋一個問題,LVM分區(qū)在安裝完成重啟后發(fā)現(xiàn)無法掛載和識別,主機環(huán)境為slse11 sp3,通過查看和處理,現(xiàn)在將結(jié)果記錄下.
一、在線解決
1、通過lvscan查看lv信息,代碼如下:
Vevb.com:~ # lvscan inactive '/dev/vgteas/lvteasdata' [2.72 TiB] inherit
發(fā)現(xiàn)lv信息是inactive狀態(tài).
2、通過vgchange激活卷組并重啟掛載,代碼如下:
- Vevb.com:~ # vgchange -a y vgteas
- 1 logical volume(s) in volume group "vgteas" now active
- Vevb.com:~ # df -hP
- Filesystem Size Used Avail Use% Mounted on
- /dev/cciss/c0d0p5 40G 920M 37G 3% /
- udev 63G 188K 63G 1% /dev
- tmpfs 63G 72K 63G 1% /dev/shm
- /dev/cciss/c0d0p1 9.9G 186M 9.2G 2% /boot
- /dev/cciss/c0d0p9 38G 9.9G 26G 28% /home
- /dev/cciss/c0d0p12 259G 772M 245G 1% /onip/teastore
- /dev/cciss/c0d0p11 99G 1.2G 93G 2% /teasredo
- Vevb.com:~ # mount -a
- Vevb.com:~ # df -hP
- Filesystem Size Used Avail Use% Mounted on
- /dev/cciss/c0d0p5 40G 920M 37G 3% /
- udev 63G 188K 63G 1% /dev
- tmpfs 63G 72K 63G 1% /dev/shm
- /dev/cciss/c0d0p1 9.9G 186M 9.2G 2% /boot
- /dev/cciss/c0d0p9 38G 9.9G 26G 28% /home
- /dev/cciss/c0d0p12 259G 772M 245G 1% /onip/teastore
- /dev/cciss/c0d0p11 99G 1.2G 93G 2% /teasredo
- /dev/mapper/vgteas-lvteasdata 2.7T 202M 2.6T 1% /teasdata
發(fā)現(xiàn)分區(qū)可以重新掛上了.
二、規(guī)避方法
(1)設(shè)置boot.lvm開機自啟動
LVM is "inactive" on first reboot after installation,避免該問題重現(xiàn),可以從以下兩方法如手.
1、查看boot.lvm服務(wù)的是否默認隨系統(tǒng)load,代碼如下:
- Vevb.com:~ # /etc/init.d/boot.lvm status
- unknown
- Vevb.com:~ # chkconfig --list|grep lvm
- lvm_wait_merge_snapshot 0:off 1:on 2:off 3:off 4:off 5:off 6:off S:on
看到狀態(tài)是unknow,也就是沒有隨機啟動,這里需要注意的是直接chkconfig --list是無法直接查看到boot.lvm服務(wù)的.
2、設(shè)置boot.lvm服務(wù)開機自啟動,代碼如下:
- Vevb.com:~ # chkconfig boot.lvm
- boot.lvm off
- Vevb.com:~ # chkconfig boot.lvm on
3、啟動boot.lvm服務(wù),代碼如下:
- Vevb.com:~ # /etc/init.d/boot.lvm start
- Waiting for udev to settle...
- Scanning for LVM volume groups...
- Reading all physical volumes. This may take a while...
- Found volume group "vgteas" using metadata type lvm2
- Activating LVM volume groups...
- PARTIAL MODE. Incomplete logical volumes will be processed.
- 1 logical volume(s) in volume group "vgteas" now active
- done
啟動后可以發(fā)現(xiàn),這里自動發(fā)現(xiàn)了vgteas卷組.
4、同redhat略有不同的是,在suse下有一部分服務(wù)在rcx.d(x為0-6)運行級別下沒有一些系統(tǒng)相關(guān)的服務(wù),這部分服務(wù)在/etc/init.d目錄下可以找到,不過其控制是否開機加載是在/etc/init.d/boot.d 目錄下的,代碼如下:
- Vevb.com:~ # ls /etc/rc.d/boot.d
- K01boot.compliance K01boot.klog K01boot.udev_retry K04boot.localfs S02boot.rootfsck S13boot.fuse S14boot.ldconfig S17boot.kdump
- K01boot.cycle K01boot.ldconfig K02boot.cleanup K06boot.rootfsck S03boot.clock S13boot.klog S14boot.quota
- K01boot.debugfs K01boot.lvm_monitor K02boot.clock K08boot.device-mapper S04boot.device-mapper S13boot.lvm_monitor S14boot.sysctl
- K01boot.efivars K01boot.proc K02boot.loadmodules K09boot.udev S04boot.loadmodules S13boot.proc S15boot.cleanup
- K01boot.fuse K01boot.quota K02boot.localnet S01boot.debugfs S10boot.localfs S13boot.scpm S15boot.ipconfig
- K01boot.ipconfig K01boot.scpm K02boot.swap S01boot.efivars S12boot.compliance S13boot.swap S16boot.apparmor
- K01boot.kdump K01boot.sysctl K03boot.apparmor S01boot.udev S13boot.cycle S13boot.udev_retry S16boot.localnet
(2),修改lvm 的默認配置文件,以下是lvm配置文件的默認配置,代碼如下:
- Vevb.com:~ # cat /etc/sysconfig/lvm
- ## Path: System/File systems/LVM
- ## Description: LVM configuration
- ## Type: string
- ## Default: ""
- #
- # This variable allows to only activate the LVM volume groups listed at
- # bootup. If it is empty, all LVM volume groups are activated at bootup.
- # This variable needs setting only under very special circumstances.
- # For almost all standard LVM installations it can safely stay empty.
- #
- LVM_VGS_ACTIVATED_ON_BOOT=""
- ## Path: System/File systems/LVM
- ## Description: LVM configuration
- ## Type: string
- ## Default: "disable"
- #
- # This variable allows newly discovered VG to be activated automatically
- # via udev rules. Set to "enable" to turn this feature on.
- #
- LVM_ACTIVATED_ON_DISCOVERED="disable"
從上面的注釋說明來看,第二個參數(shù)設(shè)置成enable可以自動發(fā)現(xiàn)一些新創(chuàng)建的lvm分區(qū)并設(shè)置為active狀態(tài),這里將上面的disable改為enable,代碼如下:
- Vevb.com:~ # sed -i 's/LVM_ACTIVATED_ON_DISCOVERED="disable"/LVM_ACTIVATED_ON_DISCOVERED="enable"/g' /etc/sysconfig/lvm
三、其他可能的原因及參考
在網(wǎng)上也查到一些其他原因可能會引起以上的情況出現(xiàn).
情況1:uuid重復(fù).
- Problem(Abstract)
- If a disk with Logical Volume Manager (LVM) on it is mounted to the original machine with the same disk, one or more duplicate Universal Unique Identifiers (UUID) are created
具體可以參看ibm站點上的技術(shù)文章,該問題貌似是redhat5等一些版本上存在的一個bug.
情況2:安裝時未使用默認安裝,導(dǎo)致未開機加載.
- The system is not installed through the defualt installer, instead bootstrapped
- through zypper and then installed additional patterns through YaST and might be
- the cause the LVM not loading;
具體參看opensuse上的文檔,這里的情況2,個人理解應(yīng)該就是由于boot.lvm服務(wù)未開機自啟動的原因,由于水平有限,并未能理解opensuse這個參考頁上最后部分想表示的意思.
新聞熱點
疑難解答
圖片精選