I think you asked a couple of interesting questions right here, which is a pity no one answered them before, so I will try to do it.
It is unclear whether the first start of the section should be 1 or 0?
The first start of the partition should be 1, because the first bytes of the disk contain the main boot record and the structure of some disk labels, such as MS-DOS. Therefore, if you use the value 0 as the beginning of the first partition, libparted will leave a few bytes at the beginning of the disk to allow this content by placing the beginning of the partition immediately after the first sector.
beginning at 1049kB ... is that normal?
This is normal. To explain this, you first need to know that for libparted, the kilobyte is not equal to 1024 bytes, instead it is equal to 1000 bytes.
KB = KiloByte = 1000Bytes
KiB = KibiByte = 1024Bytes
Additional Information:
http://en.wikipedia.org/wiki/Kilobyte
http://www.gnu.org/software/parted/manual/html_node/unit.html
The section offset is in KB (kilobytes), and its value is approximate if you change the unit to bytes:
parted /dev/sdf unit b print
you will see the real value: 1048576B
is 1MiB (1048576B ~ = 1049KB), exactly what you wanted.
I see that they start with 32k
Yes, the partition starts with 32 KB, because the tool you are using is probably too old and you are using a disk with a sector size of 512 bytes. The actual initial offset of the partition is likely to be 32256, which corresponds to sector 63. Several years ago, the partitioning tools put the beginning of the first partition in the 63rd sector to align it with the old CHS geometry. This is too long to explain, but I recommend that you read these links for more details:
https://superuser.com/questions/352572/why-does-the-partition-start-on-sector-2048-instead-of-63 http://lwn.net/Articles/377895/
If I use start 0, it prints start 512kB
I think it prints a start on 512B, not KB, am I mistaken?
On your disk of 512-byte sectors, the first sector ends at offset 511, so, as I said above, the first section begins after the first sector.
Suppose we have an overlap or increment of 1?
I change the block to bytes, you will see the actual placement of the partitions and you can check that they do not overlap.
What is the purpose of this? Is something missing?
This is because by default parted works with MiB. When entering:
parted -s -a optimal $DEV mkpart primary ext3 1 1600
You ask for a split to create a partition between offsets corresponding to MiB # 1 and # 1600. Offsets matching MiB are always aligned for maximum performance, so -a optimal
not necessary. If you change the block to bytes, you can create an unaligned section:
parted $DEV unit b mkpart primary 1000000 160MB parted $DEV align-check optimal 1
He showed the error: The resulting partition is not properly aligned for best performance.
So, try to do the same with the -a none
option:
parted -a none $DEV unit b mkpart primary 1000000 160MB
Now there is no mistake, this is the purpose of this option.
I really would like the part to be much smarter and not demanding, but rather, he can do it himself.
I think that this function will be implemented by any tool using libparted, but I think that the library is not necessary ... but who knows? maybe some libparted developer is listening ... were you trying to send an error report? bug-parted@gnu.org