Before applying a change to a logical volume (LV), it automatically creates a backup of the volume group (VG) and even an archive of the logical volume on which the operation is performed. This enables the restoration of the lost logical volume from the archive.
- To restore the LV, first fund the LV in the archive. In the below command, [VG] is the name of the volume group from which you want to restore LV. This command will display all available backups for the VG.
# vgcfgrestore -l [VG]
- Grep the string ‘command_executed’ from the output of the above command by appending the grep command as follows.
# vgcfgrestore -l [VG] | grep -A2 -B2 "<command_executed>"
- Copy the filename of backup that is your logical volume. You can pinpoint your required LV by reading the description and timestamps.
- Test the archive using the following command.
# vgcfgrestore --test -f <archive_file_path_here> [VG]
- Finally, restore LV/VG as follows.
# vgcfgrestore -f <archive_file_path> <VG name>
- Unmount the volume, reboot the server, and remount volume