1 00:00:00,000 --> 00:00:10,980 In this video, you learn about troubleshooting LVM. I will show you what you can do if at 2 00:00:10,980 --> 00:00:18,340 any time a logical volume has got lost, because you can easily repair it using vgcfgv4. Let's 3 00:00:18,340 --> 00:00:23,900 check it out. Now the nice thing about LVM is that LVM automatically writes text-based 4 00:00:23,900 --> 00:00:30,700 backups of your volume group metadata, and it does so to the etc LVM backup directory. 5 00:00:30,700 --> 00:00:36,259 In this directory, you can see that for each of the volume groups that I have on my system, 6 00:00:36,259 --> 00:00:41,820 there is a file. And if you check that file there, you can see information about what 7 00:00:41,820 --> 00:00:47,259 it has done in there. So the volume group, and we can see the physical volumes in there, 8 00:00:47,259 --> 00:00:54,900 and the device IDs, and the different swap volumes, and everything is in there. Now these 9 00:00:54,900 --> 00:01:00,419 backups are created automatically. And normally, after all changes, a backup is made automatically. 10 00:01:00,419 --> 00:01:05,059 So there's nothing that you need to do about it. The only thing that you need to do is 11 00:01:05,059 --> 00:01:16,500 vgcfgrestore-L on your volume group. So here we can see what it looks like for the CS volume 12 00:01:16,540 --> 00:01:22,900 group, which is a default volume group. So it created before executing a VG change, and after 13 00:01:22,900 --> 00:01:31,059 executing a VG change, auto-activation, and that seems to be at installation time. Now what I'm 14 00:01:31,059 --> 00:01:37,940 going to do, I'm going to remove a logical volume. So I'm using LVS, and there we can see LVLAB. 15 00:01:38,820 --> 00:01:50,099 So I'm going to use LVREMOVE-F for force on dev VGLAB LVLAB, and that should get rid of it. 16 00:01:50,099 --> 00:01:56,339 Oh no, now my logical volume is lost. Well, let's check out what you can do with vgcfgrestore. 17 00:01:57,139 --> 00:02:11,779 Step one, vgcfgrestore-L on VGLAB. And what do we see? We see created before executing LVREMOVE 18 00:02:11,779 --> 00:02:18,580 and created after executing LVREMOVE. So the thing that I care about is this one, and we need the 19 00:02:18,580 --> 00:02:24,660 file name, because this file name contains the state that I want to restore. So I'm going to 20 00:02:24,660 --> 00:02:30,740 copy this file name. But before doing anything, LVS is confirming that the logical volume is 21 00:02:30,740 --> 00:02:40,419 really gone. So now I'm using vgcfgrestore, followed by minus F and this specific file name, 22 00:02:40,419 --> 00:02:47,539 followed by the name of the volume group, VGLAB, that is. And there we can see that it restored 23 00:02:47,539 --> 00:02:56,020 the volume group VGLAB. So LVS is showing. Now look at that. LVS is showing that LVLAB is already 24 00:02:56,020 --> 00:03:03,940 present. But there's one tiny little thing. We don't see the A for active in the LVLAB logical 25 00:03:03,940 --> 00:03:13,139 volume. So I'm going to use LVCHANGE-AY, which is for active, yes. And I'm going to change that on 26 00:03:13,139 --> 00:03:23,460 VGLAB-LVLAB. And now LVS is showing that LVLAB is available. So my logical volume is back. 27 00:03:24,020 --> 00:03:30,179 Now, if it was already mounted, I would advise you reboot to make sure that the mount is made 28 00:03:30,179 --> 00:03:35,300 the right way through etcfsap or mount it manually or whatever. But at this point, 29 00:03:35,300 --> 00:03:38,259 you have successfully recovered your logical volume.