linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] fdisk and lvs size differences
@ 2008-01-09 13:36 Tomasz Chmielewski
  2008-01-09 13:43 ` Bryn M. Reeves
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Chmielewski @ 2008-01-09 13:36 UTC (permalink / raw)
  To: LVM general discussion and development

Let's say I have a 500GB logical volume:

# lvs | grep san2_data
   san2_data                  san1 -wi-a- 500.00G


fdisk will report a bigger number:

# fdisk -l /dev/san1/san2_data

Disk /dev/san1/san2_data: 536.8 GB, 536870912000 bytes



Now, if fdisk -l would report 100 GB for some partition/disk/volume, a 
volume of which size should I create with "lvcreate" when I want to copy 
data from that partition/disk/volume to a new logical volume?

I wouldn't like to waste several gigabytes of space (this would happen 
if I create a 100G volume with lvcreate), perhaps there is some magic 
formula?



-- 
Tomasz Chmielewski
http://wpkg.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] fdisk and lvs size differences
  2008-01-09 13:36 [linux-lvm] fdisk and lvs size differences Tomasz Chmielewski
@ 2008-01-09 13:43 ` Bryn M. Reeves
  2008-01-09 14:51   ` Tomasz Chmielewski
  0 siblings, 1 reply; 4+ messages in thread
From: Bryn M. Reeves @ 2008-01-09 13:43 UTC (permalink / raw)
  To: LVM general discussion and development

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tomasz Chmielewski wrote:
> Let's say I have a 500GB logical volume:
> 
> # lvs | grep san2_data
>   san2_data                  san1 -wi-a- 500.00G
> 
> 
> fdisk will report a bigger number:
> 
> # fdisk -l /dev/san1/san2_data
> 
> Disk /dev/san1/san2_data: 536.8 GB, 536870912000 bytes

It's just units; the G in lvm's output signifies powers-of-two units,
wheras the GB reported by fdisk is in powers-of-ten (SI units).

See the lvm man pages for a description of the units supported (lower
case are SI, upper case are powers-of-two).

Strictly speaking, the powers-of-two versions should use the SI binary
prefixes (MiB, GiB, etc.):

http://en.wikipedia.org/wiki/Binary_prefix

Regards,
Bryn.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHhM9w6YSQoMYUY94RAiINAKC87sqVnH6PpcQRKFuQNoMfOcpr7wCeM0gS
wsnqw+Y7qtZx/FDKNnbnSBI=
=tRAA
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] fdisk and lvs size differences
  2008-01-09 13:43 ` Bryn M. Reeves
@ 2008-01-09 14:51   ` Tomasz Chmielewski
  2008-01-09 16:13     ` Bryn M. Reeves
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Chmielewski @ 2008-01-09 14:51 UTC (permalink / raw)
  To: LVM general discussion and development

Bryn M. Reeves schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Tomasz Chmielewski wrote:
>> Let's say I have a 500GB logical volume:
>>
>> # lvs | grep san2_data
>>   san2_data                  san1 -wi-a- 500.00G
>>
>>
>> fdisk will report a bigger number:
>>
>> # fdisk -l /dev/san1/san2_data
>>
>> Disk /dev/san1/san2_data: 536.8 GB, 536870912000 bytes
> 
> It's just units; the G in lvm's output signifies powers-of-two units,
> wheras the GB reported by fdisk is in powers-of-ten (SI units).
> 
> See the lvm man pages for a description of the units supported (lower
> case are SI, upper case are powers-of-two).

What lvm manual exactly? I didn't find anything about upper/lower case 
units supported in "man lvcreate" or "man lvm". In fact, it didn't make 
a difference here whether I used "g" or "G".

Of course, I could calculate it manually, but I'd rather have it done 
automatically.


# lvcreate -L500g -n san2_data san1
   Logical volume "san2_data" created

# fdisk -l /dev/san1/san2_data

Disk /dev/san1/san2_data: 536.8 GB, 536870912000 bytes


# lvcreate -L500G -n san2_data san1
   Logical volume "san2_data" created

# fdisk -l /dev/san1/san2_data

Disk /dev/san1/san2_data: 536.8 GB, 536870912000 bytes


# lvm version
   LVM version:     2.02.07 (2006-07-17)
   Library version: 1.02.08 (2006-07-17)
   Driver version:  4.11.0

This is on Debian Etch.



-- 
Tomasz Chmielewski
http://wpkg.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] fdisk and lvs size differences
  2008-01-09 14:51   ` Tomasz Chmielewski
@ 2008-01-09 16:13     ` Bryn M. Reeves
  0 siblings, 0 replies; 4+ messages in thread
From: Bryn M. Reeves @ 2008-01-09 16:13 UTC (permalink / raw)
  To: LVM general discussion and development

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tomasz Chmielewski wrote:
> What lvm manual exactly? I didn't find anything about upper/lower case
> units supported in "man lvcreate" or "man lvm". In fact, it didn't make
> a difference here whether I used "g" or "G".

You're right - I was mistaken about using upper/lower to switch between
units in LVM2.

It doesn't change the fact that this is why you're seeing a difference
between the output of fdisk & the lvm tools though. LVM2 reports the
size using binary prefixes (powers-of-two) and fdisk uses the SI units.

Regards,
Bryn.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHhPK56YSQoMYUY94RAhcrAKDhlJvN3KGvUvH8xB+uN980g54CAQCgkwOu
Y7f7LhY08tES5SaxKkHq2Ec=
=Qy+P
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-09 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-09 13:36 [linux-lvm] fdisk and lvs size differences Tomasz Chmielewski
2008-01-09 13:43 ` Bryn M. Reeves
2008-01-09 14:51   ` Tomasz Chmielewski
2008-01-09 16:13     ` Bryn M. Reeves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).