Create file system on multipath volume

12,483

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>
Share:
12,483

Related videos on Youtube

surfcode
Author by

surfcode

C++ developer

Updated on September 18, 2022

Comments

  • surfcode
    surfcode over 1 year

    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?
  • surfcode
    surfcode almost 9 years
    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 ..
  • surfcode
    surfcode almost 9 years
    pvcreate /dev/mapper/patha seems to work fine. The rest seems to work great as well. Thank you!
  • FarDarkMist
    FarDarkMist almost 9 years
    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.
  • Spooler
    Spooler about 7 years
    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.