Creating file systems (LVM v Multipath)

Hi all

I have a system running:

 uname -o
GNU/Linux

that has already some file systems created:

 df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_outsystemdb-lv_root
                       50G  2.7G   45G   6% /
tmpfs                  28G   72K   28G   1% /dev/shm
/dev/sda1             485M   38M  422M   9% /boot
/dev/mapper/vg_outsystemdb-lv_home
                      198G  171G   17G  91% /home
/dev/mapper/vg01-lvol1
                      394G  342G   33G  92% /oradata

And there is a need to add one more file system of 500Gb , in which the storage admin has already provided me with.

But I see that the other file systems have their volume group with some nomenclature that I am not aware of it, in term of skills, like:
/dev/mapper/vg , but as far as I know to create a new file system I just have to fdisk -l the required LUN, them choose 8e as the partition type, them pvcreate , vgcreate and lastly lvcreate .
But I am not sure this is the correct procedure, because the other file systems present on the system have this /dev/mapper .
Please correct me if I am wrong with my procedure

What exactly did your system administrator give you and why didn't the system administrator create the file system. Do you have root access?

What does sudo vgdisplay show?

It is OK, that's the virtual interface that it is created when you use LVM. When you create a new logical volume these links are created by the kernel based framework device mapper; mapping target devices with its virtual layer table.
For example:

/dev/mapper/vg_outsystemdb-lv_home  

vg_outsystemdb is the name that the administrator chose when creating the volume group, using vgcreate vg_outsystemdb /dev/sd{a,b,...}
It can be any descriptive name, nothing especial.
lv_home is the name when the lv was created using lvcreate -L198G -n lv_home vg_outsystemdb
The -n is for name and it can be any descriptive name, followed by the volume group label.

Now, if you have some block storage of 500G, you can continue the scheme that appears in the df -h output, i.e.

/dev/mapper/vg01-lvol1

You can create another volume as

pvcreate /dev/<device_name>
vgcreate vg02 /dev/<device_name>

and

lvcreate -L<size> -n lvol1 vg02

That will show as /dev/mapper/vg02-lvol1 in your system
Or you can add that block storage to the current group volume

pvcreate /dev/<device_name>
vgextend vg01 /dev/<device_name>
lvcreate -L<size> -n lvol2 vg01 

Other then stuff mentioned here i would like to make a general recommendation regarding disk devices in Linux.

If you present a disk for instance /dev/xxx, create a primary partition /dev/sda1 which you will use in your volume groups / filesystems / ASM and label it like that (LVM label or other) during fdisk operation.

Why partition ?
Initial sectors are for OS information.
Easier to see and correct possible errors which are out of LVM/ASM/filesystem scope.
Disks partitioned are quite obviously used for some service (LVM, ASM etc.), while non-partitioned are not, reducing possible risk of error during administrative work.

Using full devices will work as well on Linux systems, but due to reasons above i would suggest making one primary partition if you intend to use entire disk space.

As for multipath, use /dev/mapper when creating volume groups and such.
Also using sane names for storage luns in /etc/multipath.conf helps e.g /dev/mapper/databaselun looks much more human then /dev/mapper/mpathXY

Please see if this is correct:

1st step:

 ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdd  /dev/sde  /dev/sdf  /dev/sdg  /dev/sdh  /dev/sdi  /dev/sdj

2nd step:

fdisk /dev/sdj
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xde657be6.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help):

3rd step:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 

I am now stuck, because there other file systems on this system with other partitions, so I dont know what number to choose.

Please help

You are in /dev/sdj indicated by fdisk /dev/sdj , therefore you do not have to worry by what partitions are available in the other devices /dev/sdx

fdisk is telling you that there are no partition tables in it:

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Which means you can start choosing number 1 and create your first partition.

1 Like