LVM showing as individual partition in RHEL6

Sriharsha Kalluru asked:

When I create a Logical Volume on my Hard disk and new partition is showing in fdisk -l output.

[root@linux1 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bbaa3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/mapper/vg_linux1-lv_root: 18.8 GB, 18832424960 bytes
255 heads, 63 sectors/track, 2289 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_linux1-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_linux1-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@linux1 ~]# pvs
  PV         VG        Fmt  Attr PSize  PFree
  /dev/sda2  vg_linux1 lvm2 a--  19.51g    0
[root@linux1 ~]# vgs
  VG        #PV #LV #SN Attr   VSize  VFree
  vg_linux1   1   2   0 wz--n- 19.51g    0
[root@linux1 ~]# lvs
  LV      VG        Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  lv_root vg_linux1 -wi-ao 17.54g
  lv_swap vg_linux1 -wi-ao  1.97g

Please help me how can disable showing logical volumes as individual hardsisks, Otherwise it is getting confusion if we have more number of hardisks with more number of LVM’s.

I dont want to see the LV Disks "/dev/mapper/vg_linux1-lv_root" on fdisk -l output. Please let me know if there is any configuration change to do so..

My answer:


fdisk is working as designed, even if the design is apparently-broken.

From the man page:

       -l     List the partition tables for the  specified  devices  and  then
              exit.   If no devices are given, those mentioned in /proc/partiā€
              tions (if that exists) are used.

To work around this, specify the disks you want to use explicitly. For example:

fdisk -l /dev/sd?

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.