[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Partition size technicalities. Re: Debian's recommendation for the size of the swap.



Pierfrancesco Caci wrote:
[...]
> I've a machine with 64 MB ram, 1 swap partition of about 32 MB (made
> like that when I only had 32 MB ram) 1 swap file of 127 MB (it doesn't
> take 128 MB, you must put something less).
[...]

If you really want to know why this is (probably not), partition sizes
are actually specified in cylinders. It is possible to define partition
boundaries that do not lie on cylinder boundaries, but this can be very
dangerous and most partitioning software only lets you do this with the
'expert options' or something similar.

Most disks have a geometry that is something like <num cylinders> x 255
heads x 16 sectors x 512 bytes per sector. So the size of one cylinder
is going to be 255x16x512, which is 2,088,960 bytes. Thus all of your
partition sizes are going to be multiples of that, and the closest
multiple to 128MB is 127,426,560 bytes.

While not as important with ext2fs Linux and FAT32/Win, it's a good idea
to size your partitions to the closest cylinder that resides under the
power of 2 mark (<31MB, <63MB, <511MB, etc) for minimal cluster sizes
and minimal disk space wastage. Even though newer filesystems like
ext2fs and FAT32 typically use 4k inodes or clusters, if you have 8GB
partitions then there's going to be an incredible amount of clusters or
accounting information and this will lower performance so it's good to
use multiple, smaller partitions anyways for this reason and all the
other reasons for using seperate /var, /tmp, etc. partitions.

Christopher


Reply to: