LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set exactly the partition size in Debianż (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-exactly-the-partition-size-in-debian%BF-4175584346/)

mozer 07-11-2016 01:46 PM

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

Emerson 07-11-2016 01:51 PM

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

AwesomeMachine 07-11-2016 02:11 PM

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

mozer 07-11-2016 02:21 PM

Quote:

Originally Posted by Emerson (Post 5574234)
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

Timothy Miller 07-11-2016 02:28 PM

Quote:

Originally Posted by mozer (Post 5574256)
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).

rknichols 07-11-2016 05:02 PM

Quote:

Originally Posted by AwesomeMachine (Post 5574250)
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.

hydrurga 07-11-2016 08:15 PM

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.

AwesomeMachine 07-11-2016 11:48 PM

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.

chrism01 07-12-2016 03:03 AM

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


All times are GMT -5. The time now is 08:22 PM.