How to recover LVM partitions in Linux

recover LVM partitions in Linux

[vc_row][vc_column][vc_column_text]

Recover missing LVM partition data’s in Linux.

This blog will show, how to recover missing LVM partition data’s in Linux box.

Scenario:-

One of our client server LVM meta data got corrupted and the disks are not shown while we execute, PVdisplay, LVdisplay and VGdisplay. Further, we have done below steps to recover these disks in LVM,

1. LVM will always take the backup of meta data details in /etc/lvm/backup/<vg_name> when we done any modifications. Please verify this file that it’s have all the partitions and size. Ex:-

logical_volumes {

root {
id = “j2rlvk-cGYE-fxbN-F8bO-p90r-x0FL-suSNUA”
status = [“READ”, “WRITE”, “VISIBLE”]
flags = []
creation_host = “unassigned-hostname”
creation_time = 1475126039 # 2016-09-29 10:43:59 +0530
segment_count = 2

segment1 {
start_extent = 0
extent_count = 6425 # 25.0977 Gigabytes

type = “striped”
stripe_count = 1 # linear

stripes = [
“pv0”, 0
]
}
segment2 {
start_extent = 6425
extent_count = 15360 # 60 Gigabytes

type = “striped”
stripe_count = 1 # linear

stripes = [
“pv1”, 0
]
}
}

2. Once verified all the settings, take the backup of this file and reboot the server into rescue mode.

3. After server booted into rescue mode, unmount the root partitions disk, Ex:-

#umount /dev/sda1

4. Verify, all the partitions are not mounted on the server, Ex:-

#lsblk

5. Upload the backup file of LVM meta data’s in rescue server and get the uuid of /dev/sda1, Ex:-:-

physical_volumes {

pv0 {
id = “ck9MZu-UeBT-4boe-IkJU-Q8n7-yfpX-yLK3WY”   –> copy this uuid from LVM backup file.
device = “/dev/sda1” # Hint only

6. Once done, execute below command to create Physical Volumes:-

#pvcreate –restorefile <lvm-backup-file> –uuid <uuid> <disk>

#Ex: pvcreate –restorefile <lvm-backup-file> –uuid ck9MZu-UeBT-4boe-IkJU-Q8n7-yfpX-yLK3WY /dev/sda1

7. Check if PV is created,

#pvs

8. Next, restore the VG by executing below command,

#vgcfgrestore –force <vg-name>

9. Sync VG data’s,

#vgscan

10. Check, if VG is restored properly,

#vgs

11. Next, restore the LVM’s by below command,

 #vgchange -ay <vg-name>

If you get error related to lvm-thin, then you will need the package ‘thin-provisioning-tools’. Install it by using the following command.
#apt install thin-provisioning-tools
12. Boot the server into normal mode and it should work.!

 

Thanks for reading. Let us know if you have any questions or suggestions. Keep Clouding!

[/vc_column_text][/vc_column][/vc_row]

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn
More Interested Related Posts
zfs pool usage

ZFS Pool and Dataset Usage

ZFS Pool and Dataset Usage I am back with another blog to provide the useful script to the Freebsd users to determine the zpool and

Assistanz Networks

Installing Zabbix Agent in FreeBSD 12.0

Zabbix Agent Installation and Configuration Guide on FreeBSD 12.0   Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support