Page 1 of 1

Check Encrypted Home drive for Bad Sectors

Posted: Tue Jan 03, 2023 1:38 am
by Zeno
Hi,
Im using MX Linux.
I have one seperate Hard Drive with Home flag. It is encrypted.
Now, I want to check the drive for Bad Sector.

I used Gparted of the installed MX. Not possible.
Then I tried to check it with Gparted from Booting from live MX cd Gparted. Not possible.

Can one show me the way for that.
Thanks

Re: Check Encrypted Home drive for Bad Sectors

Posted: Tue Jan 03, 2023 3:44 am
by Eadwine Rose
Two topics of yours moved from chat to help section. Please be mindful where you post, thanks.

Re: Check Encrypted Home drive for Bad Sectors

Posted: Tue Jan 03, 2023 5:15 am
by Huckleberry Finn
In all cases it needs to be decrypted (as there won't be access).

Read-write test (non-destructive)

Re: Check Encrypted Home drive for Bad Sectors

Posted: Tue Jan 03, 2023 7:00 am
by MadMax
Does badblocks require it to be decrypted, though? Since you run it against the block device, it should happily check every sector of random data it finds there. The story gets a little more complicated if you actually have bad blocks. Then you need to mount the file system to find out if and which files are affected.

Just make sure to run a non-destructive test.

Also just mentioned for completeness, badblocks will only work properly on a mechanical drive (which I think you have, since you wrote "hard drive"), since SSD controllers can remap bad blocks internally. Also bad blocks on SSDs aren't as bad as they are for a HDD.

Re: Check Encrypted Home drive for Bad Sectors

Posted: Tue Jan 03, 2023 12:53 pm
by m_pav
What MadMax said.

The badblocks command runs irrespective of the overlying file system. Boot a Live instance then after determining the correct drive location, e.g., "/dev/sda2", run the following command, replacing /dev/sda2 with the actual nomenclature of the partition you wish to check.

By default, badblocks runs in read-only mode so you should not have any issues other than a long wait because the process can take a considerable amount of time. The -s in the command will show progress.

Code: Select all

sudo badblocks -s /dev/sda2

Re: Check Encrypted Home drive for Bad Sectors

Posted: Wed Jan 04, 2023 4:40 am
by Zeno
MadMax wrote: Tue Jan 03, 2023 7:00 am Does badblocks require it to be decrypted, though? Since you run it against the block device, it should happily check every sector of random data it finds there. The story gets a little more complicated if you actually have bad blocks. Then you need to mount the file system to find out if and which files are affected.

Just make sure to run a non-destructive test.

Also just mentioned for completeness, badblocks will only work properly on a mechanical drive (which I think you have, since you wrote "hard drive"), since SSD controllers can remap bad blocks internally. Also bad blocks on SSDs aren't as bad as they are for a HDD.
Yes it is Mechanical Hard Drive.