LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2016, 01:46 PM   #1
mozer
LQ Newbie
 
Registered: Sep 2013
Posts: 17

Rep: Reputation: Disabled
Post How to set exactly the partition size in Debianż


Hi all,

I'm doing a lab with LVM and i want 10G for root

I tried with 10G and 10000000K and this is the result
Quote:
Filesystem Size Used Avail Use% Mounted on
/dev/dm-0 9.1G 780M 7.8G 9% /
Quote:
root@debian:~# lvs
lv_root vg_debian -wi-ao---- 9.31g
Why is not 10G?? What am I doing wrong?

Cheers
 
Old 07-11-2016, 01:51 PM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,959

Rep: Reputation: Disabled
There is no G or K, there is GB and kB and there is GiB and KiB. Check it out: http://physics.nist.gov/cuu/Units/binary.html
 
1 members found this post helpful.
Old 07-11-2016, 02:11 PM   #3
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora
Posts: 2,302

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
BIOS hard disk geometry is set suchwise that if you want good performance the partitions have to be aligned correctly. The smallest increment of a disk partition is a cylinder. You cannot have a partition with a fraction of a cylinder in it. That means that the partition cannot be any size. The partitioner will round up or round down to the nearest size to the desired size that lines up properly with the disk geometry
 
1 members found this post helpful.
Old 07-11-2016, 02:21 PM   #4
mozer
LQ Newbie
 
Registered: Sep 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
There is no G or K, there is GB and kB and there is GiB and KiB. Check it out: http://physics.nist.gov/cuu/Units/binary.html
Not really the installation clearly indicates G for Gigabytes and MB for Megabytes and if i use that i get

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_debian -wi-ao---- 9.31g
lv_swap vg_debian -wi-ao---- 1.86g

I set root 10GB and swap 2GB

thanks though
 
Old 07-11-2016, 02:28 PM   #5
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, Fedora & Arch mostly.
Posts: 2,339

Rep: Reputation: 631Reputation: 631Reputation: 631Reputation: 631Reputation: 631Reputation: 631
Quote:
Originally Posted by mozer View Post
Not really the installation clearly indicates G for Gigabytes and MB for Megabytes and if i use that i get

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_debian -wi-ao---- 9.31g
lv_swap vg_debian -wi-ao---- 1.86g

I set root 10GB and swap 2GB

thanks though
The reason they're being rounded down is as AwesomeMachine posted. They're automatically being aligned to the nearest full cylinder. I wish I knew how to make it round UP instead of down (I've had this issue quite a few times myself), but other than figuring out that, those numbers are the closest to what you want it's able to give you while still aligning to a cylinder (which gets REALLY odd when you start using SSD's, which of course don't have cylinders anymore but it still does it).
 
1 members found this post helpful.
Old 07-11-2016, 05:02 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,400

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by AwesomeMachine View Post
The smallest increment of a disk partition is a cylinder. You cannot have a partition with a fraction of a cylinder in it. That means that the partition cannot be any size.
That is nonsense. For hard disks manufactured in the last 30 years, the actual layout of data on the disk bears no relationship whatsoever to the CHS geometry that some partitioning tools still treat as meaningful. Modern disks have a variable number of sectors per track, with the longer, outer cylinders holding more sectors than the shorter tracks on the inner cylinders. The actual track layout is known only to the firmware on the drive. It can be inferred only by sensitive tests examining timing, and even there the drive's internal read-ahead and buffering confuse the result.

Yes, there are alignment considerations, the principal ones being the alignment of 512-byte LBA addresses with 4096-byte physical sectors, and the (unspecified) size of SSD erase blocks. Neither of these has anything to do with CHS addressing. Modern partitioning tools align partitions on 1 MiB boundaries, ignoring CHS completely.
 
1 members found this post helpful.
Old 07-11-2016, 08:15 PM   #7
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.1 MATE
Posts: 3,075

Rep: Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066Reputation: 1066
OP, can you please paste the exact pvcreate, vgcreate and lvcreate commands that you used.

Also, the output from pvdisplay, vgdisplay and lvdisplay.

Thanks.

By the way, 10000000K is not the same as 10G.
 
Old 07-11-2016, 11:48 PM   #8
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora
Posts: 2,302

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
It may seem nonsensical, but there are compelling reasons why cylinders are still used. The drives are LBA, but partitioning schemes are just now advancing to fully use LBA.
 
Old 07-12-2016, 03:03 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
This
Code:
Filesystem Size Used Avail Use% Mounted on
/dev/dm-0 9.1G 780M 7.8G 9% /
looks like its from 'df -h'.

1. There is an overhead of structuring the disk block layout ie it needs to use some space from the raw (see also the GB v GiB above) and also default 4k block for the top dir inode.
2. Default reserved space for recent mkfs eg mkfs.ext4 is 5% http://linux.die.net/man/8/mkfs.ext4

Observe:
Code:
 lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 


fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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
HTH

Last edited by chrism01; 07-12-2016 at 03:06 AM.
 
  


Reply

Tags
debian, lvm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Swap partition size: huge; any adverse effects? Debian Weapon S Linux - Newbie 14 05-09-2011 01:44 PM
How do I set default font size in Debian Sid - using xorg.conf not xfree86 walterbyrd Debian 3 02-20-2008 01:24 PM
How do I Set up Debian on a ReiserFS Root Partition? atheist Debian 3 07-12-2004 01:19 AM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 12:55 PM
fdisk partition size differs from mounted partition size jimieee Linux - General 3 10-15-2003 03:10 AM


All times are GMT -5. The time now is 10:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration