check disk for errors and fix them encrypted disk

1 reply [Última entrada]
nevermoreraven
Desconectado
Joined: 10/15/2014

How do I check my external hard drive for errors if the whole disk is encrypted?
Also how to I check and fix errors for my internal drive that has whole system encrypted swap, root, home?

teodorescup

I am a member!

Desconectado
Joined: 01/04/2011

First, locate the encrypted filesystem you need to verify:

sudo blkid | grep mapper
/dev/mapper/050root: LABEL="***" UUID="***" TYPE="xfs" 
/dev/mapper/luks-***: LABEL="***" UUID="***" TYPE="xfs"
sudo lsblk | grep dm

Then, make sure the filesystem is not mounted and depending on what that filesystem is you verify for errors.

Some examples:
for xfs

sudo xfs_check -s /dev/mapper/***

for ext*

sudo e2fsck -fC 0 /dev/dev/mapper/***

As for your root filesystem is just easier to use a live cd [boot, open encryption, scan filesystem].

For ext* partitions you can set them to verify at boot at some interval.

#current frequency number and mount count
dumpe2fs -h /dev/sd*1 | grep -i 'mount count'

#number of mounts filestune2fs -c 3 ystem will be checked
tune2fs -c 3 /dev/sd*1