Skip to contentSkip to conversation

bug? shrink lv by specifying pv extent to be removed does not behave as expected

linux-lvm Roland 5 participants 11 messages Apr 9, 2023 – Apr 13, 2023

lore
Share & tools
lore

Roland

author
#0 lore raw

hi,

we can extend a logical volume by arbitrary pv extends like this :

root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:5
  Size of logical volume mytestVG/blocks_allocated changed from 1.00 MiB (1 extents) to 2.00 MiB (2 extents).
  Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:10
  Size of logical volume mytestVG/blocks_allocated changed from 2.00 MiB (2 extents) to 3.00 MiB (3 extents).
  Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:15
  Size of logical volume mytestVG/blocks_allocated changed from 3.00 MiB (3 extents) to 4.00 MiB (4 extents).
  Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:20
  Size of logical volume mytestVG/blocks_allocated changed from 4.00 MiB (4 extents) to 5.00 MiB (5 extents).
  Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments -olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
  LV               Start SSize  Start
  blocks_allocated     0      1     0
                       0      4     1
  blocks_allocated     1      1     5
                       0      4     6
  blocks_allocated     2      1    10
                       0      4    11
  blocks_allocated     3      1    15
                       0      4    16
  blocks_allocated     4      1    20
                       0 476917    21

how can i do this in reverse ?

when i specify the physical extend to be added, it works - but when is specifcy the physical extent to be removed, the last one is being removed but not the specified one.

see here for example - i wanted to remove extent number 10 like i did add it, but instead extent number 20 is being removed

root@s740:~# lvresize mytestVG/blocks_allocated -l -1 /dev/sdb:10
  Ignoring PVs on command line when reducing.
  WARNING: Reducing active logical volume to 4.00 MiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mytestVG/blocks_allocated? [y/n]: y
  Size of logical volume mytestVG/blocks_allocated changed from 5.00 MiB (5 extents) to 4.00 MiB (4 extents).
  Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments -olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
  LV               Start SSize  Start
  blocks_allocated     0      1     0
                       0      4     1
  blocks_allocated     1      1     5
                       0      4     6
  blocks_allocated     2      1    10
                       0      4    11
  blocks_allocated     3      1    15
                       0 476922    16

how can i remove extent number 10 ?

is this a bug ?

regards
roland

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#1 lore raw
Quoted 73 lines · Roland

hi,

we can extend a logical volume by arbitrary pv extends like this :

root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:5
   Size of logical volume mytestVG/blocks_allocated changed from 1.00
MiB (1 extents) to 2.00 MiB (2 extents).
   Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:10
   Size of logical volume mytestVG/blocks_allocated changed from 2.00
MiB (2 extents) to 3.00 MiB (3 extents).
   Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:15
   Size of logical volume mytestVG/blocks_allocated changed from 3.00
MiB (3 extents) to 4.00 MiB (4 extents).
   Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:20
   Size of logical volume mytestVG/blocks_allocated changed from 4.00
MiB (4 extents) to 5.00 MiB (5 extents).
   Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments
-olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
   LV               Start SSize  Start
   blocks_allocated     0      1     0
                        0      4     1
   blocks_allocated     1      1     5
                        0      4     6
   blocks_allocated     2      1    10
                        0      4    11
   blocks_allocated     3      1    15
                        0      4    16
   blocks_allocated     4      1    20
                        0 476917    21

how can i do this in reverse ?

when i specify the physical extend to be added, it works - but when is specifcy the physical extent to be removed,
the last one is being removed but not the specified one.

see here for example - i wanted to remove extent number 10 like i did add it, but instead extent number 20
is being removed

root@s740:~# lvresize mytestVG/blocks_allocated -l -1 /dev/sdb:10
   Ignoring PVs on command line when reducing.
   WARNING: Reducing active logical volume to 4.00 MiB.
   THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mytestVG/blocks_allocated? [y/n]: y
   Size of logical volume mytestVG/blocks_allocated changed from 5.00
MiB (5 extents) to 4.00 MiB (4 extents).
   Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments
-olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
   LV               Start SSize  Start
   blocks_allocated     0      1     0
                        0      4     1
   blocks_allocated     1      1     5
                        0      4     6
   blocks_allocated     2      1    10
                        0      4    11
   blocks_allocated     3      1    15
                        0 476922    16
Quoted 4 lines

how can i remove extent number 10 ?

is this a bug ?

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a
working fs. You can only reduce fs'es (the ones that you can reduce)
by reducing off of the end and making it smaller.

It makes zero sense to be able to remove a block in the middle of a LV used by just about everything that uses LV's as nothing supports being able to remove a block in the middle.

What is your use case that you believe removing a block in the middle of an LV needs to work?

Now if you really need to remove a specific block in the middle of the LV then you are likely going to need to use pvmove with specific blocks to replace those blocks with something else.

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

author
#2 lore raw
Quoted 4 lines

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a
working fs. You can only reduce fs'es (the ones that you can reduce)
by reducing off of the end and making it smaller.

yes, that's clear to me.

Quoted 3 lines

It makes zero sense to be able to remove a block in the middle of a LV used by just about everything that uses LV's as nothing supports being able to remove a block in the middle.

yes, that critics is totally valid. from a fs point of view you completely corrupt the volume, that's clear to me.

Quoted 2 lines

What is your use case that you believe removing a block in the middle of an LV needs to work?

my use case is creating some badblocks script with lvm which intelligently handles and skips broken sectors on disks which can't be used otherwise...

my plan is to scan a disk for usable sectors and map the logical volume around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have a usable lv without broken sectors.

since you need to rebuild your data anyway for that disk, you can also recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try out how much use you can have from some dead disks which are trash otherwise...

the manpage is telling this:

Resize an LV by specified PV extents.

lvresize LV PV ...
[ -r|--resizefs ]
[ COMMON_OPTIONS ]

so, that sounds like that i can resize in any direction by specifying extents.

Quoted 3 lines

Now if you really need to remove a specific block in the middle of the LV then you are likely going to need to use pvmove with specific blocks to replace those blocks with something else.

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a bad sector ?

the data may be corrupted anywhy, so i thought it's better to skip it.

what i'm really after is some "remap a physical extent to a healty/reserved section and let zfs selfheal do the rest". just like "dismiss the problematic extents and replace with healthy extents".

i'd better like remapping instead of removing a PE, as removing will invalidate the whole LV....

roland

Am 09.04.23 um 19:32 schrieb Roger Heflin:

Quoted 93 lines · Roland
Quoted 72 lines

hi,

we can extend a logical volume by arbitrary pv extends like this :

root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:5
    Size of logical volume mytestVG/blocks_allocated changed from 1.00
MiB (1 extents) to 2.00 MiB (2 extents).
    Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:10
    Size of logical volume mytestVG/blocks_allocated changed from 2.00
MiB (2 extents) to 3.00 MiB (3 extents).
    Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:15
    Size of logical volume mytestVG/blocks_allocated changed from 3.00
MiB (3 extents) to 4.00 MiB (4 extents).
    Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# lvresize mytestVG/blocks_allocated -l +1 /dev/sdb:20
    Size of logical volume mytestVG/blocks_allocated changed from 4.00
MiB (4 extents) to 5.00 MiB (5 extents).
    Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments
-olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
    LV               Start SSize  Start
    blocks_allocated     0      1     0
                         0      4     1
    blocks_allocated     1      1     5
                         0      4     6
    blocks_allocated     2      1    10
                         0      4    11
    blocks_allocated     3      1    15
                         0      4    16
    blocks_allocated     4      1    20
                         0 476917    21

how can i do this in reverse ?

when i specify the physical extend to be added, it works - but when is specifcy the physical extent to be removed,
the last one is being removed but not the specified one.

see here for example - i wanted to remove extent number 10 like i did add it, but instead extent number 20
is being removed

root@s740:~# lvresize mytestVG/blocks_allocated -l -1 /dev/sdb:10
    Ignoring PVs on command line when reducing.
    WARNING: Reducing active logical volume to 4.00 MiB.
    THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce mytestVG/blocks_allocated? [y/n]: y
    Size of logical volume mytestVG/blocks_allocated changed from 5.00
MiB (5 extents) to 4.00 MiB (4 extents).
    Logical volume mytestVG/blocks_allocated successfully resized.
root@s740:~# pvs --segments
-olv_name,seg_start_pe,seg_size_pe,pvseg_start  -O pvseg_start
    LV               Start SSize  Start
    blocks_allocated     0      1     0
                         0      4     1
    blocks_allocated     1      1     5
                         0      4     6
    blocks_allocated     2      1    10
                         0      4    11
    blocks_allocated     3      1    15
                         0 476922    16
Quoted 4 lines

how can i remove extent number 10 ?

is this a bug ?

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a
working fs. You can only reduce fs'es (the ones that you can reduce)
by reducing off of the end and making it smaller.

It makes zero sense to be able to remove a block in the middle of a LV used by just about everything that uses LV's as nothing supports being able to remove a block in the middle.

What is your use case that you believe removing a block in the middle of an LV needs to work?

Now if you really need to remove a specific block in the middle of the LV then you are likely going to need to use pvmove with specific blocks to replace those blocks with something else.

Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#3 lore raw
Quoted 59 lines · Roland
Quoted 5 lines

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a
working fs. You can only reduce fs'es (the ones that you can reduce)
by reducing off of the end and making it smaller.

yes, that's clear to me.

Quoted 3 lines

It makes zero sense to be able to remove a block in the middle of a LV used by just about everything that uses LV's as nothing supports being able to remove a block in the middle.

yes, that critics is totally valid. from a fs point of view you completely corrupt the volume, that's clear to me.

Quoted 2 lines

What is your use case that you believe removing a block in the middle of an LV needs to work?

my use case is creating some badblocks script with lvm which intelligently handles and skips broken sectors on disks which can't be used otherwise...

my plan is to scan a disk for usable sectors and map the logical volume around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have a usable lv without broken sectors.

since you need to rebuild your data anyway for that disk, you can also recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try out how much use you can have from some dead disks which are trash otherwise...

the manpage is telling this:

Resize an LV by specified PV extents.

lvresize LV PV ...
[ -r|--resizefs ]
[ COMMON_OPTIONS ]

so, that sounds like that i can resize in any direction by specifying extents.

Quoted 3 lines

Now if you really need to remove a specific block in the middle of the LV then you are likely going to need to use pvmove with specific blocks to replace those blocks with something else.

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a bad sector ?

the data may be corrupted anywhy, so i thought it's better to skip it.

Quoted 9 lines

what i'm really after is some "remap a physical extent to a healty/reserved section and let zfs selfheal do the rest". just like "dismiss the problematic extents and replace with healthy extents".

i'd better like remapping instead of removing a PE, as removing will invalidate the whole LV....

roland

Create an LV per device, and when the device is replaced then lvremove the devices list. Once a sector/area is bad I would not trust the sectors until you replace the device. You may be able to try the pvmove multiple times and the disk may be able to eventually rebuild the data.

My experience with bad sectors is once it reports bad the disks will often rewrite it at the same location and call it "good" when it is going to report bad again almost immediately, or be a uselessly slow
sector. Sometimes it will replace the sector on a
re-write/successful read but that seems unreliable.

On non-zfs fs'es I have found the "bad" file and renamed it badfile.#### and put it in a dir called badblocks. So long as the bad block is in the file data then you can contain the badblock by
containing the bad file. And since most of the disk will be file
data that should also be a management scheme not requiring a fs rebuild.

The re-written sector may also be "slow" and it might be wise to treat those sectors as bad, and in the "slow" sector case pvmove should actually work. For that you would need a badblocks that "timed" the reads to disk and treats any sector taking longer that even say .25
seconds as slow/bad. At 5400 rpm, .25/250ms translates to around 22
failed re-read tries. If you time it you may have to do some testing
on the entire group of reads in smaller aligned sectors to figure out which sector in the main read was bad. If you scanned often enough for slows you might catch them before they are completely bad. Technically the disk is supposed to do that on its scans, but even when I have turned the scans up to daily it does not seem to act right.

And I have usually found that the bad "units" are 8 units of 8 512-byte sectors for a total of around 32k (aligned on the disk).

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

author
#4 lore raw

thank you, very valuable!

Am 09.04.23 um 20:53 schrieb Roger Heflin:

Quoted 97 lines · Roland
Quoted 54 lines
Quoted 4 lines

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a
working fs. You can only reduce fs'es (the ones that you can reduce)
by reducing off of the end and making it smaller.

yes, that's clear to me.

Quoted 3 lines

It makes zero sense to be able to remove a block in the middle of a LV used by just about everything that uses LV's as nothing supports being able to remove a block in the middle.

yes, that critics is totally valid. from a fs point of view you completely corrupt the volume, that's clear to me.

Quoted 2 lines

What is your use case that you believe removing a block in the middle of an LV needs to work?

my use case is creating some badblocks script with lvm which intelligently handles and skips broken sectors on disks which can't be used otherwise...

my plan is to scan a disk for usable sectors and map the logical volume around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have a usable lv without broken sectors.

since you need to rebuild your data anyway for that disk, you can also recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try out how much use you can have from some dead disks which are trash otherwise...

the manpage is telling this:

Resize an LV by specified PV extents.

lvresize LV PV ...
[ -r|--resizefs ]
[ COMMON_OPTIONS ]

so, that sounds like that i can resize in any direction by specifying extents.

Quoted 3 lines

Now if you really need to remove a specific block in the middle of the LV then you are likely going to need to use pvmove with specific blocks to replace those blocks with something else.

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a bad sector ?

the data may be corrupted anywhy, so i thought it's better to skip it.

Quoted 9 lines

what i'm really after is some "remap a physical extent to a healty/reserved section and let zfs selfheal do the rest". just like "dismiss the problematic extents and replace with healthy extents".

i'd better like remapping instead of removing a PE, as removing will invalidate the whole LV....

roland

Create an LV per device, and when the device is replaced then lvremove the devices list. Once a sector/area is bad I would not trust the sectors until you replace the device. You may be able to try the pvmove multiple times and the disk may be able to eventually rebuild the data.

My experience with bad sectors is once it reports bad the disks will often rewrite it at the same location and call it "good" when it is going to report bad again almost immediately, or be a uselessly slow
sector. Sometimes it will replace the sector on a
re-write/successful read but that seems unreliable.

On non-zfs fs'es I have found the "bad" file and renamed it badfile.#### and put it in a dir called badblocks. So long as the bad block is in the file data then you can contain the badblock by
containing the bad file. And since most of the disk will be file
data that should also be a management scheme not requiring a fs rebuild.

The re-written sector may also be "slow" and it might be wise to treat those sectors as bad, and in the "slow" sector case pvmove should actually work. For that you would need a badblocks that "timed" the reads to disk and treats any sector taking longer that even say .25
seconds as slow/bad. At 5400 rpm, .25/250ms translates to around 22
failed re-read tries. If you time it you may have to do some testing
on the entire group of reads in smaller aligned sectors to figure out which sector in the main read was bad. If you scanned often enough for slows you might catch them before they are completely bad. Technically the disk is supposed to do that on its scans, but even when I have turned the scans up to daily it does not seem to act right.

Quoted 8 lines

And I have usually found that the bad "units" are 8 units of 8 512-byte sectors for a total of around 32k (aligned on the disk).

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#5 lore raw
In reply to Roland

I use a utility that maps bad sectors to files, then move/rename the files into a bad blocks folder. (Yes, this doesn't work when critical areas are affected.) If you simply remove the files, then modern disks will internally remap the sectors when they are written again - but the quality of remapping implementations varies.

It is more time efficient to just buy a new disk, but with wars and rumors of wars threatening to disrupt supply chains, including tech, it's nice to have the skills to get more use from failing hardware.

Plus, it is a challenging problem, which can be fun to work on at leisure.

Quoted 5 lines · Roland
Quoted 2 lines

What is your use case that you believe removing a block in the middle of an LV needs to work?

my use case is creating some badblocks script with lvm which intelligently handles and skips broken sectors on disks which can't be used otherwise...

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#6 lore raw
In reply to Roland

Dne 09. 04. 23 v 20:21 Roland napsal(a):

Quoted 10 lines
Quoted 3 lines

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a working fs.   You can only reduce fs'es (the ones that you can reduce)

my plan is to scan a disk for usable sectors and map the logical volume around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have a usable lv without broken sectors.

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.

HDD bad sectors are spreading - and slowly the surface gets destroyed....

So if you make large 'head-room' around bad disk areas - if they are concentrated on some disk area - and you know topology of you disk drive like i.e. 1% free disk space before and after bad area - you could possibly use disk for a little while more - but only to store invaluable data....

Quoted 5 lines

since you need to rebuild your data anyway for that disk, you can also recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try out how much use you can have from some dead disks which are trash otherwise...

You could always take 'vgcfgbackup' of lvm2 metadata and make some crazy transition of if with even AWK/python/perl - but we really tend to support
just some useful features - as there is already 'too much' and users are getting often lost.

One very simply & naive implementation could be going alonge this path -

whenever you want to create new arrangement for you disk with 'bad' areas,
you can always start from 'scratch' - since afterall - lvm2 ONLY manipulates with metadata within disk front - so if you need to create new 'holes',
just 'pvcreate -f', vgcreate, and 'lvcreate -Zn -Wn'
and then 'lvextend' with normal or 'lvextend --type error | --type zero' segment types around bad areas with specific size.
Once you are finished and your LV precisely matches your 'previous' LV of you past VG - you can start to use this LV again with new arrangement of 'broken zeroed/errored' areas.

I've some serious doubts about usability of this with any filesystem :) but if you think this has some added value - fell free to use.
If the drive you play with would be 'discardable' (SSD/NVMe) then one must take extra care there is no 'discard/TRIM' anywhere in the process - as that would lose all data irrecoverably....

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...

Quoted 5 lines

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a bad sector ?

pvmove CANNOT be used with bad drives - it cannot deal with erroring sectors and basically gets stuck there trying to mirror unrecoverable disk areas...

Regards

Zdenek

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

author
#7 lore raw
Quoted 1 line

Reall silly plan  - been there years back in time when drives were FAR

more expensive with the price per GiB.

Quoted 1 line

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.

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
of buying a new one, as they are cheap. with the patch, the tube is always worse then a new one. and he probably risks
his own health, because of using a tube which may already have gotten porous...

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 ?

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...

Quoted 1 line

whenever you want to create new arrangement for you disk with 'bad'

areas,

Quoted 1 line

you can always start from 'scratch' - since afterall - lvm2 ONLY

manipulates with metadata within disk front -

Quoted 3 lines

so if you need to create new 'holes',
just   'pvcreate -f', vgcreate,   and 'lvcreate -Zn -Wn' and then  'lvextend'  with normal  or  'lvextend --type error | --type

zero' segment types around bad areas with specific size.

Quoted 1 line

Once you are finished and your LV precisely matches your 'previous'

LV of you past VG - you can start to use this LV again with

Quoted 1 line

new arrangement of  'broken zeroed/errored' areas.

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.

Quoted 1 line

But good advice from me - whenever  'smartctl' starts to show

relocation block errors - it's the right moment to  'dd_rescue'

Quoted 1 line

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 any pointers for such and did not find any information, on "how fast a bad disk gets worse,  if it has irretrievable bad sectors and smart is reporting relocation errors. there seems not much information around for this...

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....

roland

Am 12.04.23 um 12:20 schrieb Zdenek Kabelac:

Quoted 72 lines

Dne 09. 04. 23 v 20:21 Roland napsal(a):

Quoted 11 lines
Quoted 3 lines

Well, if the LV is being used for anything real, then I don't know of anything where you could remove a block in the middle and still have a working fs.   You can only reduce fs'es (the ones that you can reduce)

my plan is to scan a disk for usable sectors and map the logical volume around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have
a usable lv without broken sectors.

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.

HDD bad sectors are spreading - and slowly the surface gets destroyed....

So if you make large 'head-room' around bad disk areas - if they are concentrated on some disk area - and you know topology of you disk drive like i.e. 1% free disk space before and after bad area - you could possibly use disk for a little while more - but only to store invaluable data....

Quoted 7 lines

since you need to rebuild your data anyway for that disk, you can also recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try
out how much use you can have from some dead disks which are trash otherwise...

You could always take  'vgcfgbackup'  of lvm2 metadata and make some crazy transition of if with even  AWK/python/perl   -  but we really tend to support
just some useful features - as there is already  'too much' and users are getting often lost.

One very simply & naive implementation could be going alonge this path -

whenever you want to create new arrangement for you disk with 'bad' areas,
you can always start from 'scratch' - since afterall - lvm2 ONLY manipulates with metadata within disk front - so if you need to create new 'holes',
just   'pvcreate -f', vgcreate,   and 'lvcreate -Zn -Wn' and then  'lvextend'  with normal  or  'lvextend --type error | --type zero' segment types around bad areas with specific size. Once you are finished and your LV precisely matches your 'previous' LV of you past VG - you can start to use this LV again with new arrangement of  'broken zeroed/errored' areas.

I've some serious doubts about usability of this with any filesystem :) but if you think this has some added value - fell free to use. If the drive you play with would be 'discardable' (SSD/NVMe) then one must take extra care there is no 'discard/TRIM' anywhere in the process - as that would lose all data irrecoverably....

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...

Quoted 6 lines

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a
bad sector ?

Quoted 10 lines

pvmove  CANNOT be used with bad drives - it cannot deal with erroring sectors and basically gets stuck there trying to mirror unrecoverable disk areas...

Regards

Zdenek

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#8 lore raw

Dne 12. 04. 23 v 14:37 Roland napsal(a):

Quoted 10 lines
Quoted 1 line

Reall silly plan  - been there years back in time when drives were FAR

more expensive with the price per GiB.

Quoted 1 line

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.

Quoted 2 lines

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....

Quoted 2 lines

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....

Quoted 3 lines

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 ?

Quoted 3 lines

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....

Quoted 8 lines
Quoted 1 line

But good advice from me - whenever  'smartctl' starts to show

relocation block errors - it's the right moment to  'dd_rescue'

Quoted 1 line

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....

Quoted 8 lines

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

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#9 lore raw
In reply to Roland

"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 ?"

with hard drives (forget SSDs, they are hardware accelerators absolutely unaffordable for data storing) it is not the user/owner that decide it , unless he doesn't want to suicide his data

is the SMART system that tells you that one first reallocation happen

Sectors reallocation are not allowed

Those few 100 or 250 sectors are just for the SMART system

As soon just one reallocation happen, it is time to waste the drive

Like with car tyres, when you reach the marker , it is time to waste them, but if you run too few kilometers per year, after few years the gum got dried and you create a risk for yourself and the others if you don waste them

This comparison applies to hard drives

If the weekly SMART test tells you that a drive is in pre-failure (just reallocations happen, few mean 3 - 4 - 5) you have been warned:

it is time to waste "the tyre"

You don't do that, you was warned

Il giorno 12 apr 2023, 14:37, alle ore 14:37, Roland <[email protected]> ha scritto:

Quoted 159 lines
Quoted 1 line

Reall silly plan  - been there years back in time when drives were FAR

more expensive with the price per GiB.

Quoted 1 line

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.

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
of buying a new one, as they are cheap. with the patch, the tube is always worse then a new one. and he probably risks
his own health, because of using a tube which may already have gotten porous...

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 ?

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...

Quoted 1 line

whenever you want to create new arrangement for you disk with 'bad'

areas,

Quoted 1 line

you can always start from 'scratch' - since afterall - lvm2 ONLY

manipulates with metadata within disk front -

Quoted 3 lines

so if you need to create new 'holes',
just   'pvcreate -f', vgcreate,   and 'lvcreate -Zn -Wn' and then  'lvextend'  with normal  or  'lvextend --type error | --type

zero' segment types around bad areas with specific size.

Quoted 1 line

Once you are finished and your LV precisely matches your 'previous'

LV of you past VG - you can start to use this LV again with

Quoted 1 line

new arrangement of  'broken zeroed/errored' areas.

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.

Quoted 1 line

But good advice from me - whenever  'smartctl' starts to show

relocation block errors - it's the right moment to  'dd_rescue'

Quoted 1 line

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 any pointers for such and did not find any information, on "how fast a bad disk gets worse,  if it has irretrievable bad sectors and smart is reporting relocation errors. there seems not much information around for this...

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....

roland

Am 12.04.23 um 12:20 schrieb Zdenek Kabelac:

Quoted 2 lines

Dne 09. 04. 23 v 20:21 Roland napsal(a):

Quoted 1 line
Quoted 1 line

Well, if the LV is being used for anything real, then I don't know

of

Quoted 1 line
Quoted 1 line
Quoted 1 line

anything where you could remove a block in the middle and still

have a

Quoted 1 line
Quoted 1 line
Quoted 1 line

working fs.   You can only reduce fs'es (the ones that you can

reduce)

Quoted 2 lines
Quoted 2 lines

my plan is to scan a disk for usable sectors and map the logical

volume

Quoted 8 lines
Quoted 6 lines

around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones to have
a usable lv without broken sectors.

Reall silly plan  - been there years back in time when drives were

FAR

Quoted 6 lines

more expensive with the price per GiB.

Todays - just throw bad drive to recycle bin - it's not worth to do this silliness.

HDD bad sectors are spreading - and slowly the surface gets

destroyed....

Quoted 3 lines

So if you make large 'head-room' around bad disk areas - if they are concentrated on some disk area - and you know topology of you disk

drive

Quoted 6 lines

like i.e. 1% free disk space before and after bad area - you could possibly use disk for a little while more - but only to store invaluable data....

Quoted 1 line

since you need to rebuild your data anyway for that disk, you can

also

Quoted 7 lines
Quoted 6 lines

recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want to try
out how much use you can have from some dead disks which are trash otherwise...

Quoted 7 lines

You could always take  'vgcfgbackup'  of lvm2 metadata and make some crazy transition of if with even  AWK/python/perl   -  but we really tend to support
just some useful features - as there is already  'too much' and users are getting often lost.

One very simply & naive implementation could be going alonge this

path -

Quoted 5 lines

whenever you want to create new arrangement for you disk with 'bad' areas,
you can always start from 'scratch' - since afterall - lvm2 ONLY manipulates with metadata within disk front - so if you need to

create

Quoted 3 lines

new 'holes',
just   'pvcreate -f', vgcreate,   and 'lvcreate -Zn -Wn' and then  'lvextend'  with normal  or  'lvextend --type error |

--type

Quoted 5 lines

zero' segment types around bad areas with specific size. Once you are finished and your LV precisely matches your 'previous' LV of you past VG - you can start to use this LV again with new arrangement of  'broken zeroed/errored' areas.

Quoted 8 lines

I've some serious doubts about usability of this with any filesystem :) but if you think this has some added value - fell free to use. If the drive you play with would be 'discardable' (SSD/NVMe) then one must take extra care there is no 'discard/TRIM' anywhere in the process - as that would lose all data irrecoverably....

But good advice from me - whenever  'smartctl' starts to show relocation block errors - it's the right moment to  'dd_rescue' any

LV

Quoted 8 lines

to your new drive...

Quoted 6 lines

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents located on a
bad sector ?

Quoted 10 lines

pvmove  CANNOT be used with bad drives - it cannot deal with erroring sectors and basically gets stuck there trying to mirror unrecoverable disk areas...

Regards

Zdenek

Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#10 lore raw
In reply to Zdenek Kabelac

Zdenek is right

But if in this exact moment one or more drive do have not only bad sectors "reallocated" but also "pending" ones

the best choice is to preserve them shutting them off and allowing a PRO cloning process with machines like PC-3000

But first at a PRO lab, they will open the drive in clean room for the sake of check and verify WHY SMART are so bad for such amount of sectors

If recovering the data is a must, failing the preservation of the bad SMART drives , will result in loosing them and together the data too.

Read on the data recovery guide published on the website of the told company

R.

⁣ ​

Il giorno 12 apr 2023, 12:20, alle ore 12:20, Zdenek Kabelac <[email protected]> ha scritto:

Quoted 103 lines

Dne 09. 04. 23 v 20:21 Roland napsal(a):

Quoted 1 line
Quoted 1 line

Well, if the LV is being used for anything real, then I don't know

of

Quoted 1 line
Quoted 1 line

anything where you could remove a block in the middle and still have

a

Quoted 1 line
Quoted 1 line

working fs.   You can only reduce fs'es (the ones that you can

reduce)

Quoted 2 lines

my plan is to scan a disk for usable sectors and map the logical

volume

Quoted 3 lines

around the broken sectors.

whenever more sectors get broken, i'd like to remove the broken ones

to have

Quoted 2 lines

a usable lv without broken sectors.

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.

HDD bad sectors are spreading - and slowly the surface gets destroyed....

So if you make large 'head-room' around bad disk areas - if they are concentrated on some disk area - and you know topology of you disk drive
like i.e. 1% free disk space before and after bad area - you could possibly
use disk for a little while more - but only to store invaluable data....

Quoted 1 line

since you need to rebuild your data anyway for that disk, you can

also

Quoted 3 lines

recreate the whole logical volume.

my question and my project is a little bit academic. i'd simply want

to try

Quoted 1 line

out how much use you can have from some dead disks which are trash

otherwise...

You could always take 'vgcfgbackup' of lvm2 metadata and make some crazy
transition of if with even AWK/python/perl - but we really tend to
support
just some useful features - as there is already 'too much' and users are
getting often lost.

One very simply & naive implementation could be going alonge this path -

whenever you want to create new arrangement for you disk with 'bad' areas,
you can always start from 'scratch' - since afterall - lvm2 ONLY manipulates
with metadata within disk front - so if you need to create new 'holes',
just 'pvcreate -f', vgcreate, and 'lvcreate -Zn -Wn'
and then 'lvextend' with normal or 'lvextend --type error | --type zero'
segment types around bad areas with specific size.
Once you are finished and your LV precisely matches your 'previous' LV of you
past VG - you can start to use this LV again with new arrangement of 'broken
zeroed/errored' areas.

I've some serious doubts about usability of this with any filesystem :) but if
you think this has some added value - fell free to use.
If the drive you play with would be 'discardable' (SSD/NVMe) then one must
take extra care there is no 'discard/TRIM' anywhere in the process - as that
would lose all data irrecoverably....

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...

Quoted 4 lines

yes, pvmove is the other approach for that.

but will pvmove continue/finish by all means when moving extents

located on a

Quoted 1 line

bad sector ?

pvmove CANNOT be used with bad drives - it cannot deal with erroring sectors
and basically gets stuck there trying to mirror unrecoverable disk areas...

Regards

Zdenek

Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/