Home » How To » HOWTO: Fixing a raw device misconfiguration

HOWTO: Fixing a raw device misconfiguration

If you were observent in the Mapping Linux LVM and Raw partitions blog post, you probably noticed that there are two raw devices pointing to the same logical volume

raw -qa
/dev/raw/raw1:  bound to major 253, minor 7
/dev/raw/raw2:  bound to major 253, minor 8
/dev/raw/raw3:  bound to major 253, minor 9
/dev/raw/raw4:  bound to major 253, minor 10
/dev/raw/raw5:  bound to major 253, minor 12
/dev/raw/raw6:  bound to major 253, minor 13
/dev/raw/raw7:  bound to major 253, minor 15
/dev/raw/raw8:  bound to major 253, minor 15
/dev/raw/raw10: bound to major 253, minor 16
/dev/raw/raw11: bound to major 253, minor 17

Correcting this misconfiguration is easy but can be painful if the devices have been put to use (maybe as a database device).  Since we’ve already done the mapping (see Mapping Linux LVM and Raw partitions), we know the devices that they should be mapped to.

Let’s assume that no one has starting using either raw device and fix it the easy way (as root):

raw /dev/raw/raw7 /dev/dbvg/rawdatavol07
/dev/raw/raw7:  bound to major 253, minor 14
raw /dev/raw/raw8 /dev/dbvg/rawdatavol08
/dev/raw/raw8:  bound to major 253, minor 15

We have one more step, we need to update whatever script is run at start up to configure the raw devices to make sure that the mapping is retained after we reboot:

On RedHat and derived distributions, we modify the /etc/sysconfig/rawdevices:

/dev/raw/raw1 /dev/dbvg/rawdatavol01
/dev/raw/raw2 /dev/dbvg/rawdatavol02
/dev/raw/raw3 /dev/dbvg/rawdatavol03
/dev/raw/raw4 /dev/dbvg/rawdatavol04
/dev/raw/raw5 /dev/dbvg/rawdatavol05
/dev/raw/raw6 /dev/dbvg/rawdatavol06
/dev/raw/raw7 /dev/dbvg/rawdatavol07
/dev/raw/raw8 /dev/dbvg/rawdatavol08
/dev/raw/raw10 /dev/dbvg/rawdatavol10
/dev/raw/raw11 /dev/dbvg/rawdatavol11

RedHat provides the script file /etc/init.d/rawdevices that will read the /etc/sysconfig/rawdevices and while we could use it to correct the raw device mappings…. It is my understanding that remapping of the raw devices that are in use may allow for loss of data at the instant that the remapping takes place.  So, we avoid the whole situation and run the raw command on only the devices that are mismapped.

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Facebook login by WP-FB-AutoConnect