Lvm – Why does the lvm physical volume have significantly less space than the partition it contains

lvm

I'm on centOS 6.4.
I have a 39TB hardware RAID configured as RAID 6.
I created a single 39TB partition with parted. It reports:

(parted) print                                                        
Model: JetStor JetStor -VOL#000 (scsi) Disk /dev/sdb: 39.0TB Sector
size (logical/physical): 512B/512B Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags  1     
1049kB  39.0TB  39.0TB               primary

I created an lvm linear volume like so:

pvcreate /dev/sdb1
vgcreate vg_jet716s /dev/sdb1
lvcreate -L 30T -n lv_jet716s_1 vg_jet716s

Then I created an XFS fs on lv_jet716s_1, matching the raid stripe width and number:

mkfs.xfs -d su=64k,sw=13 /dev/mapper/vg_jet716s-lv_jet716s_1

But pvs outputs this:

[root@cfile ~]# pvs   PV         VG         Fmt  Attr PSize   PFree   
/dev/sda2  vg_cfile   lvm2 a--  464.76g 285.62g
/dev/sdb1  vg_jet716s lvm2 a--   35.47t   5.47t

I don't think I checked what pvs was outputing after creating just the physical volume. I probably only called 'lvs' to see that the logical volume had been created witht the right size. Here's lvs and vgs:

[root@cfile ~]# lvs
  LV           VG         Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_root      vg_cfile   -wi-ao--- 50.00g                                             
  lv_swap      vg_cfile   -wi-ao--- 31.48g                                             
  lv_var       vg_cfile   -wi-ao--- 97.66g                                             
  lv_jet716s_1 vg_jet716s -wi-ao--- 30.00t                                             
[root@cfile ~]# vgs
  VG         #PV #LV #SN Attr   VSize   VFree  
  vg_cfile     1   3   0 wz--n- 464.76g 285.62g
  vg_jet716s   1   1   0 wz--n-  35.47t   5.47t

Any thoughts? I'm new to this and it's really surprising to lose almost 10% of my space. Thanks!

-Michael

Best Answer

Unfortunately, your tools are not being meticulous about whether values are in TB or TiB. The volume is actually about 36 TiB, not 36 TB. The partition is actually about 39 TB, not 39 TiB.

36 TiB = (36 * 1024) GiB = 36,864 GiB
36,864 GiB = (36,864 * 1024) MiB = 37,748,736 MiB.

If you go all the way to bytes, you get 39,582,418,599,936 bytes, or about 39.6 TB.

So 36 TiB is approximately 39 TB.

Related Topic