Linux: Run fsck On LUKS (dm-crypt) Based LVM Physical Volume

To run fsck on a LUKS (dm-crypt) based LVM physical volume, you need to follow these steps:

  1. Unlock the LUKS partition: First, you need to unlock the LUKS partition to access the LVM physical volume. You can do this by running the following command:
sudo cryptsetup luksOpen /dev/<device> <luks_mapper_name>

Replace <device> with the actual device name (e.g. /dev/sda1) and <luks_mapper_name> with the name you want to assign to the unlocked LUKS partition (e.g. luks-vol1).

  1. Scan LVM physical volume: After unlocking the LUKS partition, you can scan the LVM physical volume using the following command:
sudo vgscan
  1. Activate LVM volume group: Next, you need to activate the LVM volume group by running the following command:
sudo vgchange -ay
  1. Run fsck: Finally, you can run fsck on the LVM physical volume by specifying the corresponding logical volume (e.g. /dev/mapper/<volume_group_name>-<logical_volume_name>). For example:
sudo fsck /dev/mapper/<volume_group_name>-<logical_volume_name>

Note that you should run fsck on a unmounted partition, so you may need to temporarily unmount any mounted partitions before running the fsck command.

Keep in mind that running fsck on a LUKS (dm-crypt) based LVM physical volume can take a long time, especially if the volume is large. Also, make sure to backup important data before running fsck, as there is a risk of data loss or corruption.

(https://www.ebsta.com/)

Leave a Comment