Headless home server - Boot via GPT/EFI UUID

My Headless home server (Seagate Dockstar) doesn't have a standard boot manager.
It simply boots a uBoot image, either from it's NAND or from an external HDD. All this is set up in it's BIOS.
Unfortunately it doesn't have a iLO/DRAC/SIMC/IPMI so that I can control the BIOS over a network connection.
Anyway, this amazingly cheap/"low power" device comes with a crippled OS and I like ArchLinux ARM a lot better.
Since ALARM (short for ArchLinux ARM) doesn't fit in the small NAND I have to setup the BIOS to point it to an external USB device.
But there's a downside to this. Since the PlugPC has 4 USB ports and since the HDD's don't always take the same amount of time handshaking with the BIOS on boot-up, what happens is that sometimes disk A is sda and disk B is sdb but some other times disk A is sdb and disk B is sda. Rather confusing...for us and for the small server too.
And worst of all, when the change happens the device won't boot up because it can't find the boot device on the USB port that it expected it to be.
Some time ago Linux introduced the UUID in the GPT/EFI partitions and the good thing is the latest BIOS' can deal with UUID.
The UUID is by definition a unique alphanumeric identifier that is registered to the partitions when these are created. While it is not impossible to have two partitions with the same UUID, this random-generated string is so big that the odds to hit the same string in a lifetime are 1 in millions.
The only catch is that you have to partition the disk using GPT/EFI.
I usually use cgdisk to partition my devices which is a menu-driven partitioning tool compatible with GPT.
So, simply:
# cgdisk /dev/sdX
Remove the unwanted partitions and create the new ones. Write the new partition scheme and select [info].
You will get some useful info on the current partition along with the UUID.
Check this example:

Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Boot partition)
Partition unique GUID: 6BAD4248-FC6D-4487-A255-A3B57504BE10
First sector: 16065 (at 7.8 MiB)
Last sector: 131106464 (at 62.5 GiB)
Partition size: 131090400 sectors (62.5 GiB)
Attribute flags: 0000000000000000
Partition name: Boot partition

The one you need is the "unique GUID": 6BAD4248-FC6D-4487-A255-A3B57504BE10

After that you just need to change the BIOS parameters to:
fw_setenv usb_set_bootargs 'setenv bootargs console=$console root=PARTUUID=6BAD4248-FC6D-4487-A255-A3B57504BE10 rootwait rootfstype=ext4 $mtdparts $usb_custom_params'

And that's it. Hope this helps you.
Cheers

Comments

  1. ubuntu@ubuntu:/media/ubuntu$ sudo mkfs.ext2 /dev/sdc1mke2fs 1.42.13 (17-May-2015)
    Creating filesystem with 307200 1k blocks and 76912 inodes
    Filesystem UUID: 9091902a-78e4-4fce-a2f5-d2d0f23dbce6
    Superblock backups stored on blocks:
    8193, 24577, 40961, 57345, 73729, 204801, 221185

    Allocating group tables: done
    Writing inode tables: done
    Writing superblocks and filesystem accounting information: done



    ubuntu@ubuntu:/media/ubuntu$ sudo mkfs.ext4 /dev/sdc2
    mke2fs 1.42.13 (17-May-2015)
    Creating filesystem with 900603 4k blocks and 225344 inodes
    Filesystem UUID: 5f21ec2a-36b0-40ce-a530-feada659a831
    Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736

    Allocating group tables: done
    Writing inode tables: done
    Creating journal (16384 blocks): done
    Writing superblocks and filesystem accounting information: done

    ReplyDelete

Post a Comment

Popular posts from this blog

Headless home server - Setting up Dynamic DNS (FreeDNS) and IPv6 tunnel (HE.net)

[Howto] USB sniffing