1 (edited by gedakc 2016-05-04 22:01:11)

Topic: [closed] Handle MB and sector to create partitions, not only MiB

Hi there,

I have recently had a problem with my partition table (I accidentally erased it). I realized immediately and I didn't turn the PC Off. Although the partition table was physically erased, all the information was still there (I could find it using Disk Utility or  Gparted or the command: cat /proc/partitions). So I would've been able to re-create the partition structure with Gparted before turning the PC off, and everything would be solved.

Actually, I couldn't. The reason is that the Ubuntu installation uses MB (so my partitions were created in MB units), but Gparted uses MiB... they don't match.

For instance, upon installation I created my swap partition as 4096 MB. This is 3096,25 MiB... I can not introduce this value onto Gparted.

So my suggestion is to include the ability of creating partitions on MB (or even bytes, as in the Disk Utility) and also sectors (as in /proc/partitions).

In my case, you will wonder why I didn't use the Gparted Rescue Live CD... I did, but I have RAID 0 installed on my PC, so it only found 3 of my 5 partitions (same result than Testdisk). The solution was to use the Ubuntu Live Installation CD, re-create the partitions using MB (as the original ones) and then restore a previous backup of the / partition I had. I finally got it all working, but using a walkaround not based on Gparted.

Thanks a lot you guys for providing us with a so powerful tool... for free!!! I hope this suggestion may help.

2

Re: [closed] Handle MB and sector to create partitions, not only MiB

4096 MB is exactly 4096000000/512 = 8000000 sectors.
4095 or 4097 MB don't fit an integer number of sectors. I can't see how a partition would include a fraction of a disk sector. As far as I know, partitioning schemes like MBR and GUID use logical blocks of 512 bytes as units (even some recent models with 4KiB sectors continue to work with the 512-byte model, I read).
Logical addressing is surely more flexible than the old Cylinder-Head-Sector concept, but I think that the binary model is still powerful.

I don't know if there is any formatting scheme (concerning the filesystem, not the partition it self) that could be based on any arbitrary selectable length in bytes.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: [closed] Handle MB and sector to create partitions, not only MiB

Thank you for your reply.

Sincerely, I am not an expert on disk structures and definitios, so it is possible that my request should be, let's say, adapted to "real world". My main concern is about the difference between the Ubuntu installation (in MB) and the Gparted partition creation process (in MiB), since they don't fit. Therefore, when you start from scratch and create your partition structure using Ubuntu installation on your PC, then it is very probable you can not re-create them using Gparted (this was my case).

Perhaps the solution to the issue you comment on your post is to "round" the values the user may introduce, to the physical capabilities of the disk... As stated before, the main issue to address is to allow that the installation partitions and the Gparted features to be aligned. Then, I can imagine that what the installation process is able to produce, would be also feasible afterwards.