# FAQ

##### 無法新增 PV

> Device /dev/sdj not found (or ignored by filtering).

Solution: 可能該磁碟有包含其他磁區

```
# fdisk -l /dev/sdj

WARNING: GPT (GUID Partition Table) detected on '/dev/sdj'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdj: 3848.3 GB, 3848290697216 bytes
255 heads, 63 sectors/track, 467861 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdj1               1      267350  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.
```

移除這磁碟裡的所有磁區後再試一次。

##### 移除已損壞的 PV

無法移除已經損壞 PV 的 VG 與 LV

> 有一個 PV - /dev/sdc 發生損毀，所屬 VG 與 LV 要移除時遇到錯誤：
> 
>  Couldn't find device with uuid APgmaN-yCZG-WfQS-L5zm-vd6g-oEJc-WjzNrT.  
>  Can't remove locked LV isths\_DMS
> 
>  Couldn't find device with uuid APgmaN-yCZG-WfQS-L5zm-vd6g-oEJc-WjzNrT.  
>  WARNING: Partial LV isths\_home needs to be repaired or removed.  
>  WARNING: Partial LV isths\_DMS needs to be repaired or removed.  
>  WARNING: Partial LV pvmove0 needs to be repaired or removed.  
>  There are still partial LVs in VG vg\_db.  
>  To remove them unconditionally use: vgreduce --removemissing --force.  
>  Proceeding to remove empty missing PVs.

Solution: VG Name: vg\_db

```
# vgcfgbackup vg_db
  Couldn't find device with uuid APgmaN-yCZG-WfQS-L5zm-vd6g-oEJc-WjzNrT.
  Volume group "vg_db" successfully backed up.
```

/etc/lvm/backup/vg\_db:

```
...
logical_volumes {
...
...
}
... 
```

> 將段落 logical\_volumes 整個移除。

執行 vgcfgrestore

```
# vgcfgrestore vg_db
  Restored volume group vg_db
```

重新掃描再重新執行移除 LV 與 VG

```
pvs
vgs
lvs
vgremove vg_db
```

##### USB 掛載包含有 LVM 的硬碟，出現錯誤訊息

> \# mount -t ext3 /dev/VolGroup00/LogVol00 /mnt/lvm00  
>  mount: wrong fs type, bad option, bad superblock on /dev/mapper/VolGroup00-LogVol00,  
>  missing codepage or helper program, or other error  
>  In some cases useful info is found in syslog - try  
>  dmesg | tail or so

Solution:

```shell
vgchange -an VolGroup00
vgchange -ay VolGroup00
mount -t ext3 /dev/VolGroup00/LogVol00 /mnt/lvm00
```

##### 無法新增 LV

系統剛安裝完，執行 pvdisplay -C 出現錯誤，並且無法新增 LV

> Couldn't find device with uuid ZrneWS-8KHd-UiXV-rQ4q-YU0o-r9Ga-0ZVBPW

Solution: 這個硬碟可能曾經做過 LVM 格式化，這些是之前遺留的裝置名稱，要清除這些不存在的舊設定。

```
# vgreduce -removemissing <vg-name>
```

> TIPs：
> 
>  要查出這些不存在的 device 的所屬 VG，可以執行 pvdisplay 。

##### 建立 GPT 磁區

With parted

```
# parted /dev/vdb
GNU Parted 3.4
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel GPT                                                      
(parted) mkpart primary 2048s 100%                                        
(parted) q                                                                
Information: You may need to update /etc/fstab.
```