[Top][All Lists]

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

Re: [patch] search for partition using GPT GUID

Subject: Re: [patch] search for partition using GPT GUID
Date: Thu, 11 Mar 2010 20:13:24 +0530

GPT GUID is one of the best FILESYSTEM-INDEPENDENT way of uniquely
identifying a partition.

Most people who use GPT are thos who have need for many primary
partitions. I use GPT in my internal 320 GB HDD (12 partitions) and
500 GB USB 2.0 external (11 partitions).

My guess of the workflow of grub2's search command :-

1) Read the partition table both the disks.
2) Find the starting/ending sectors of First Partition.
3) Detect its filesystem
4) Check for its UUID/GUID (length/uniqueness depends on the FS.
5) If the UUID matches, set it as the root part (set root=*)
6) If the UUID is different repeat steps 2,3,4 and 5 for 2nd partition
(and so on).

The time taken for this operation depends on the number of partitions
and the filesystem in each part. If one uses a 4 TB drive with 40
partitions of 100 GB (approx) each. GRUB2 has to read all the
partitions, its filesystems in order till a UUID match is found. This
will take a long time and will take more time depending on the not of
disks connected.

But if GPT GUID is used, only the partition table needs to be accessed
and each partition entry is checked for its "Partition Unique GUID"
till a match is found. This is way faster since no filesystem is
accessed and that accessing time is saved (especially for more no. of
partitions). Maybe even the GPT Disk GUID can be used to reference a
GPT disk (instead of confusion over whether it is (hd1) or (hd2) and
so on.

Also I have no-FS partitions like BIOS-Boot incase of grub2, ie lets
say I dd copy some bootloader to an unknown (my own random) GUID
partition (like the way grub2 core.img is embedded in GPT-BIOS mode)
in one of the external HDD, and I connect 2 external HDDs, how will I
know which one is /dev/sdb and which one is /dev/sdc. SInce that part
has no FS, the only way to uniquely reference that partition is using
it "Unique GPT GUID". Also FS like FAT do not have UUIDs which can be
regarded as unique. The main reason GPT table is good is because it
provided FS-independent way to reference a part thus removing
abiguity. Hope this test case is sufficient. Thank you.

PS : Please change the behavior of "help" command in grub2 shell as it
is not possible to see all possible commands (it scrolls past screen
and I see commands starting from s-alphabet only)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]