Tuesday, February 11, 2014

iSCSI LVM Red Hat/CEntOS/Oracle Linux

Today I learned a couple of important things about LVMs on iSCSI.  First, a silly one - pvcreate against a slice (or partition - sorry, my Sun Solaris is showing) - NOT against a disk.  That is, /dev/sda1 NOT /dev/sda.  I coulda swore you could use the disk and LVM would take care of the details.  Again, probably thinking of ZFS and Sun Solaris.

The other really important things is you MUST use _netdev in place of defaults in the /etc/fstab.  For example:

   /dev/mapper/vg_oracle-lv_u01 /u01 ext4 _netdev  0 0

This is a serious gotcha!  If you don't do this, the device disappears from /dev/mapper.  Pretty unnerving!  

The other cool thing I picked up was, if you lose the /dev/mapper device, you can get it back (assuming you tinkered with iscsi restarts a bit) simply by issuing the command "vgchange -ay".  That was a neat trick and prompted this blog post.

That is all.

2 comments:

RAT said...

ok - Just spoke with a Red Hat engineer - he says you CAN use the entire disk, and, in fact, in most cases THAT is "Best Practices".

Hmmm...

RAT said...

"The command that creates Physcal Volumes is called pvcreate. We can run it against a partition (pvcreate /dev/sdb1) or directly against physical drive (pvcreate /dev/sdb). The second option seems easier, because we can skip the partition definition. You should, however, avoid using it. There is a possibility that other partitioning tools and operating systems might not recognize that the disk is being used by LVM, if there is no valid partition on it. Such tools might also try to initialize the disk, which will be fatal for the data. To encourage good practices we will create a single partition on all four drives, that we plan to use with LVM. Let’s start with /dev/sdb." from http://manchev.org/2011/11/introduction-to-logical-volume-manager/