Operating System - HP-UX
1833323 Members
2770 Online
110051 Solutions
New Discussion

Re: Create LV on a disk with a bad block

 
hp admin
Frequent Advisor

Create LV on a disk with a bad block

Please, how can I create a Logical Volume on a disk with bad blocks ?

And is there some way to ignore these blocks, so I can use my disk even if it damage ?
4 REPLIES 4
RAC_1
Honored Contributor

Re: Create LV on a disk with a bad block

Yes it is possible. You can create lvol with -r n option. (Bad block relocation turned off)

man lvcreate to know more details.

lvcreate -L "size" -r n /dev/vgxx /disk

Anil
There is no substitute to HARDWORK
Jeff Schussele
Honored Contributor

Re: Create LV on a disk with a bad block

Hi,

IF the disk is not already in use then you can run the mediainit command on it to spare out the bad blocks - use it as follows:

mediainit /dev/rdsk/cXtYdZ

Note the need to use the raw device.

Then just
pvcreate/vgcreate/lvcreate/newfs it as normal.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: Create LV on a disk with a bad block

You can specify -r y in the lvcreate command but this is the default behavior. A disk in this condition is an accident waiting to happen so it is really time to replace it.

You might have better luck with a mediainit command and let it identify and spare the bad blocks for you but I would still replace the disk.
If it ain't broke, I can fix that.
Chauhan Amit
Respected Contributor

Re: Create LV on a disk with a bad block

Bad Block Relocation needs to be turned to off with the lvchange -r n
command for the boot, root, primary swap, and dump Logical Volumes. LVM bad-
block relocation is not supported for any logical volume containing the root
filesystem ("/"), the boot filesystem ("/stand"), primary swap or dump. When
the OS is loaded, by default, it will create theses Logical Volumes with bad-
block relocation turned off.

Bad Block Relocation can either be on, off, or none. To determine what it is
set to, use the lvdisplay command:

# lvdisplay /dev/vg00/lvol4
--- Logical volumes ---
LV Name /dev/vg00/lvol4
...
Bad block on

To modify the Bad Block Relocation policy, use the lvchange command:

lvchange -r y - Turns Bad Block Relocation on
lvchange -r n - Turns Bad Block Relocation off
lvchange -r N - Turns Bad Block Relocation NONE

If Bad Block Relocation is turned on then upon a media failure
(detection of a bad block of data on disk), LVM will mark the failed block in
the Bad Block Directory, and attempt to relocate the block to a new location on
disk.

If Bad Block Relocation is turned off then upon a media failure, LVM
will mark the failed block as bad in the Bad Block Directory, but will NOT
attempt to relocate the bad block to a new location on disk.

If Bad Block Relocation is turned to NONE then upon a media failure,
LVM will NOT attempt to relocate the bad block. In addition it will NOT enter
the block in the Bad Block Directory. LVM will have no record of the block
being bad, and will attempt to access it on future I/O requests.

General Rules for Setting Bad Block Relocation

By default Bad Block Relocation is turned on, when any Logical Volume is
created.



If you are not a part of solution , then you are a part of problem