I have a server with two hard drives that I thought I had correctly installed with LVM, until I discovered that the second hard-drive did not actually seem to be used. I investigated the problem and followed some instructions found online, but the problem got worse. Apparently, my initial mistake was to remove the physical volume with pvremove
when I should have used mvreduce
.
I am attaching below more information. I am using Ubuntu Server 14.04 LTS. I should also mention that I don't have any data on the second hard drive that I need to recover, this disk can be completely wiped.
My logical volume apollo2-vg
was supposed to be made of sda3
and sdb
:
root@apollo2:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 745.2G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 244M 0 part /boot
└─sda3 8:3 0 744.5G 0 part
├─apollo2--vg-root (dm-0) 252:0 0 1.2T 0 lvm /
└─apollo2--vg-swap_1 (dm-1) 252:1 0 255.9G 0 lvm [SWAP]
sdb 8:16 0 745.2G 0 disk
└─apollo2--vg-root (dm-0) 252:0 0 1.2T 0 lvm /
with the following overview of my partitions:
root@apollo2:~# parted -l
Model: ATA LITEON IT ECE-80 (scsi)
Disk /dev/sda: 800GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 boot
2 538MB 794MB 256MB ext2
3 794MB 800GB 799GB lvm
Model: ATA LITEON IT ECE-80 (scsi)
Disk /dev/sdb: 800GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/apollo2--vg-root: 1325GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 1325GB 1325GB ext4
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/apollo2--vg-swap_1: 275GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 275GB 275GB linux-swap(v1)
The problem is that sdb
(on the second hard drive) is now missing:
root@apollo2:~# pvscan
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
PV /dev/sda3 VG apollo2-vg lvm2 [744.47 GiB / 0 free]
PV unknown device VG apollo2-vg lvm2 [745.21 GiB / 0 free]
Total: 2 [1.45 TiB] / in use: 2 [1.45 TiB] / in no VG: 0 [0 ]
This is confirmed by lvdisplay
:
root@apollo2:~# lvdisplay
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
--- Logical volume ---
LV Path /dev/apollo2-vg/root
LV Name root
VG Name apollo2-vg
LV UUID W7afVo-nWcn-qwDf-hLvB-uFkV-LbEL-iX7FLj
LV Write Access read/write
LV Creation host, time apollo2, 2015-03-14 17:20:12 +0100
LV Status available
# open 1
LV Size 1.20 TiB
Current LE 315847
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/apollo2-vg/swap_1
LV Name swap_1
VG Name apollo2-vg
LV UUID aHegDA-NP47-dkUg-nY3L-HNp7-Y8xM-lflNFs
LV Write Access read/write
LV Creation host, time apollo2, 2015-03-14 17:20:12 +0100
LV Status available
# open 2
LV Size 255.90 GiB
Current LE 65511
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
and pvdisplay
:
root@apollo2:~# pvdisplay
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
--- Physical volume ---
PV Name /dev/sda3
VG Name apollo2-vg
PV Size 744.47 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 190584
Free PE 0
Allocated PE 190584
PV UUID 2p7KM5-dWVY-z1uw-auBy-QXHQ-6aVl-mezqAY
--- Physical volume ---
PV Name unknown device
VG Name apollo2-vg
PV Size 745.21 GiB / not usable 1.84 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 190774
Free PE 0
Allocated PE 190774
PV UUID f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe
Following advice found on the internet, I tried many things, like re-creating the missing device:
root@apollo2:~# pvcreate /dev/sdb --uuid=f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe --norestorefile
Device /dev/sdb not found (or ignored by filtering).
Or removing it from the volume group:
root@apollo2:~# vgreduce --removemissing --verbose apollo2-vg
Finding volume group "apollo2-vg"
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
There are 1 physical volumes missing.
Trying to open VG apollo2-vg for recovery...
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
There are 1 physical volumes missing.
Archiving volume group "apollo2-vg" metadata (seqno 11).
WARNING: Partial LV root needs to be repaired or removed.
There are still partial LVs in VG apollo2-vg.
To remove them unconditionally use: vgreduce --removemissing --force.
Proceeding to remove empty missing PVs.
Creating volume group backup "/etc/lvm/backup/apollo2-vg" (seqno 12).
root@apollo2:~# vgreduce --removemissing --force --verbose apollo2-vg
Finding volume group "apollo2-vg"
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
There are 1 physical volumes missing.
Trying to open VG apollo2-vg for recovery...
Couldn't find device with uuid f2hTAw-yDWd-8DH1-1fhy-Kfwk-mIui-6isUfe.
There are 1 physical volumes missing.
Archiving volume group "apollo2-vg" metadata (seqno 12).
Removing partial LV root.
Logical volume apollo2-vg/root contains a filesystem in use.
Unfortunately, none of the solutions I tried worked. I don't have a lot of experience with LVM, and I am afraid the problem might get worse if I keep trying to solve it without really understanding what is going on.
I read that some people with a similar problem could not reboot their machine correctly, which would be the worst case scenario.
Hopefully there is a simple solution. Thank you in advance for your help!