System Administration & Network Administration
linux filesystems lvm multipath
Updated Sun, 28 Aug 2022 03:50:11 GMT

Create file system on multipath volume


I'm completely new to linux admin and file system. Recently we acquired an HP MSA P2000 san. I've setup the disk into a vdisk and created 3 volumes on it. On Centos 7, I've also setup the multipath mapper and have those volumes mapped into /dev/mapper/mpatha, mpathb and mpathc.

I saw on a couple of web site that they do the following: (whichever is the underlying disk of e.g. mpatha)

 # fdisk /dev/sdd
 # kpartx -a /dev/mapper/mpatha
 # mkfs.ext3 /dev/mapper/mpathap1

to format the disk. Redhat DM multipath document recommend

 # pvcreate /dev/mapper/mpatha

to create an LVM volume.

My question is

  1. For the former, when the volume is expanded later, do I need to backup and fdisk, mkfs the entire /dev/sdd again?
  2. For the latter, it seems like vdisk and volume creation is already managed by the HP P2000 disk management tool, it seems I don't really need to further create partitions/volumes on top of it. Should I probably not LVM here, no?
  3. What's the right thing to do? do I really need to 'format' and initialize a further partition?



Solution

1. For the former, when the volume is expanded later, do I need to backup and fdisk, mkfs the entire /dev/sdd again?

You don't

pvcreate /dev/mapper/mpatha

But instead

pvcreate /dev/mapper/mpatha1

Then when you expand your disk, you do a fdisk to create a new partition and you do a>

pvcreate /dev/mapper/mpatha2
vgextend VOLGROUPNAME /dev/mapper/mpatha2

2.For the latter, it seems like vdisk and volume creation is already managed by the HP P2000 disk management tool, it seems I don't really need to further create partitions/volumes on top of it. Should I probably not LVM here, no?

Believe me, you want to. Managing disk spaces with pvs vgs and lvms is really neat and easy

3.What's the right thing to do? do I really need to 'format' and initialize a further partition?

pvcreate /dev/bla
vgcreate vgname /dev/bla
lvcreate -n lv_name -L 1G vgname
mkfs.ext4 /dev/mapper/<vgname>-<lvname>

When you want to get more space:

lvextend -L +1G  /dev/mapper/<vgname>-<lvname>
resize2fs  /dev/mapper/<vgname>-<lvname>




Comments (4)

  • +0 – thanks. Could you point more information why I need to do 'pvcreate' on path /dev/mapper/mpatha1 instead of /dev/mapper/mpatha? I see some other site mentioned /dev/mapper/mpathap1 after kpartx -a .. — Jul 17, 2015 at 03:26  
  • +0 – pvcreate /dev/mapper/patha seems to work fine. The rest seems to work great as well. Thank you! — Jul 17, 2015 at 10:13  
  • +0 – As i said before. When you whant to grow up your LUN its easer to add another partition and another PV without messing with your first partition. Otherwise you will be resizing the partition and using pvresize. I'm glad everything worked for you. — Jul 17, 2015 at 14:52  
  • +1 – Nah, don't even partition it. That's just a needless layer of complexity. If you expand a PV, you can run pvresize /dev/mapper/mpatha to re-detect volume size and then automatically expand. — Apr 04, 2017 at 00:41