Monday, August 29, 2016

Restoring LVM Post-Install

I had to reinstall my linux operating system with an existing LVM over RAID. During the install I formatted one of the physical volumes PV. I used it for / (root), swap and /boot partitions. I could have used the existing Logical Volume LV for these but this device is also encrypted. I doubt I can reuse it without unlocking it. So I simply wiped it clean and made a clean install. After reboot I checked the status of the LVM and the RAID. Both are okay-ish. The RAID is clean according to mdadm. LVM informed me that the volume group is degraded. I'm missing a physical volume. I know I wiped it clean.

So how do I restore the volume group so I can get at my data.

LVM keeps its configuration files in /etc/lvm/backups and also in /etc/lvm/archives/"name-of-volume-group". So pick the current or latest one in /etc/lvm/backups or the older ones in /etc/lvm/archives/"volume-group". You need two things - the backup configuration file and the UUID of the physical volume. Using the terminal type:

#pvcreate --uuid UUID  --restorefile PATH-TO-THE-BACKUP-FILE-VOLUME-GROUP.VG /dev/sda

Unfortunately, I get an error message telling me that the Device is not found. (or ignored by filter). So I have to check the /etc/lvm.conf if by chance my device is simply being ignored or left out, simply not detected due to an uncommented line in the file.

I think in my case the physical volume was really wiped out, formatted, erased including the metadata. So, can I restore the volume group instead with the remaining physical volume? With the commands pvdisplay, vgdisplay and lvdisplay, it looks promising that I could. After consulting the man pages for vgreduce and vgchange I hit the terminal again.

#vgreduce --removemissing  ubuntu-vg

If you have data in the missing volumes, first try to salvage it. Afterwards, the remaining logical volumes are activated with this command:

#vgchange --activate y ubuntu-vg

Now check the status of your LVM with pvdisplay, vgdisplay and lvdisplay. My logical volumes now appear on the file manager, so that's a good sign I have saved the data.

Donato Roque @ubuntu-16-04
I'm on twitter and facebook.
Check out my blog.
Consider using my PGP keys for privacy. 

Monday, August 22, 2016

Blogging This Tweet From Sen. Risa Hontiveros

The lives lost as of today, 22nd of August 2016, is at 1,800.

Thursday, August 18, 2016

Status of Logical Volumes After 30 Days

It's been a while since I created these logical volumes and extended my volume group (the only one) to include the newly grown raid5 array on a 2-2-1 TB device. Frown all you want as long as it works. When that 1 TB HDD shows some signs of failing or error, I'll replace it with a 2TB HDD. The raid array will then be a complete 2-2-2 TB raid5.

Here's the status of the raid array now:

I'm replacing the 1 TB HDD when it fails or errors, or when I need to increase the capacity of the array, whichever comes first. The present raid array size is 2 TB.
Donato Roque @desktop-ubuntu
I'm on twitter and facebook .
Web: Danny's Space
Consider using my pgp keys for privacy.