[linux-lvm] bug? shrink lv by specifying pv extent to be removed does not behave as expected

Zdenek Kabelac zdenek.kabelac at gmail.com
Wed Apr 12 13:16:16 UTC 2023


Dne 12. 04. 23 v 14:37 Roland napsal(a):
>  >Reall silly plan  - been there years back in time when drives were FAR
> more expensive with the price per GiB.
>  >Todays - just throw bad drive to recycle bin - it's not worth to do
> this silliness.
> 
> ok, i understand your point of view. and thank you for the input.
> 
> but this applies to a world with endless ressources and when people can
> afford the new hardware.
> 

Hi

It's really not about the 'endless' resource - it's just about 'practical' 
thinking.

> i think, with the same logic, you can designate some guy to be silly ,
> if he puts a patch on his bicycle inner tube instead

To use your comparative case with bicycle - you wouldn't likely ride one - 
where the 'next' hole in the tube would be appearing randomly & unexpectedly
during your future rides - you would simply buy a new tube to be sure you 
could get somewhere....

Bad drives are highly unpredictable - so as long as you simply don't care 
about data and you store there just something you could easily download again 
from some other place - that could be the only use case I could imagine,
but I'd never put there you only copy of your family album....

> but shouldn't we perhaps leave it up to the end user / owner of the
> hardware,  to decide when it's ready for the recycle bin ?

Yeah - if the hardware would cost more :) then the time you spend with trying 
to analyze and use bad drives - than there would be whole 'recycling' industry 
for these drives - thankfully where are not heading towards this  ATM :)
What I could observe is that HDD of 'small' sizes are being totally obsoleted 
by SSDs/NMVes....

> or should we perhaps wait for the next harddrive supply crisis (like in
> 2011)?  then people start to get more creative in using
> what they have, because they have no other option...

Assuming you are already preparing horses in the barn ?

> yes, i have already come to the conclusion, that it's always better to
> start from scratch like this. i dismissed the idea of
> excluding or relocating bad sectors.

The key is - that you know how the drive is built and how many disk plates are 
affected and also how quickly errors are spreading to surrounding sectors....

My best effort was always to leave some not so small amount of the 'free' 
space around bad disk areas - but once disks started to 'relocate' bad sectors 
on its own - this all became a game hard to win....

>  > But good advice from me - whenever  'smartctl' starts to show
> relocation block errors - it's the right moment to  'dd_rescue'
>  > any LV to your new drive...
> 
> yes, i'm totally aware that we walk on very thin ice here.
> 
> but i'd really like to collect some real world data/information on how
> good such disk "recycling" can probably work.  i don't have

Maybe ask Google people :) they are the most experienced ones with trashing 
storage....

> 
> i guess such "broken" disks being used with zfs in a redundant setup,
> they could probable still serve a purpose. maybe not
> for production data, but probably good enough for "not so important"
> application.
> 
> it's a little bit academic project. for my own fun. i like to fiddle
> with disks, lvm, zfs and that stuff....

Another idea to 'deploy' (I've been even using myself) - is to just mkfs.ext2 
bad drive and and write there large sized (10MiB-100MiB) files of 'zeroes'.

Then simply md5 checksum - and remove 'correct' ones and keep and mark 
immutable those, where you fail to read&validate them.

With some amount of luck - ext2 metadata will not hit the 'bad' parts of drive
(otherwise you would really need to use parted or lvm2 to skip those areas)

This way you end-up with somewhat 'usable' storage -  where bad sectors are 
hidden in those broken 'zero' files you just keep in filesystem.

Next time the 'error' spread  - you reapply same strategy.

And you even don't need lvm2 for this....

This is the easiest way how to keep 'some' not fatally broken drives in use 
for a while - but just don't put there anything you depend on - as drive can 
be gone anytime very easily.....

Regards

Zdenek



More information about the linux-lvm mailing list