LVM on a drive with a bad sector?
I have a drive I was getting ready to change to LVM. When moving all the old files off I noticed it seems to have a bad sector on the drive.. not unlikely as I move a lot so the disks take a lot of physical abuse.. but only that one bad sector. Is there anything special I should do before using the drive with LVM to mark the sector as bad so that LVM just works around it? So far there is no evidence that the entire drive is failing.
Quoted 7 lines · Michael
I have a drive I was getting ready to change to LVM. When moving all the old files off I noticed it seems to have a bad sector on the drive.. not unlikely as I move a lot so the disks take a lot of physical abuse.. but only that one bad sector. Is there anything special I should do before using the drive with LVM to mark the sector as bad so that LVM just works around it? So far there is no evidence that the entire drive is failing.
Running with bad harddisks is generally a bad idea. What you should try to do is run the manufacturers diagnostic tools over your hdd to swap out the bad sector in the hdd's internal bad sector list (it will use spare good blocks to swap it with). For Maxtor you can do this with the PowerMax tool, other vendors have their own tools.
If this does not work, you can use LVM (as far as I know there is no bad-block mapping within LVM, correct me if I'm wrong) but you need to specify the bad block when making the filesystem. You can do this by creating the logical volume, and then using 'badblocks' to locate the bad block. This information can be passed to mke2fs for instance to make it avoid the bad block (using the -l option). All other filesystems have their own mechanism for this (if any).
Bottom line is, when a drive starts having bad sectors it's not reliable anymore and further deterioration is possible. If you use a mirrored configuration I think you can take the risk, but if you're not, you'd better make sure you have a good backup system in place :)
My few cents,
Martijn
Quoted 2 lines · Martijn Schoemaker
(as far as I know there is no
bad-block mapping within LVM, correct me if I'm wrong)
The closest in LVM2 would be to put the bad sectors inside a single LV and avoid using that LV.
e.g. lvcreate -l1 vg -n broken /dev/sda5:46
if the bad sector falls inside physical extent 46 on /dev/sda5.
Alasdair
Signature · 1 line
[email protected]