No, you cannot grub-install /dev/disk/by-uuid/foo
. This is not saying it is impossible, one might concoct a method, but it is impractical at the least.
UUIDs (universally unique identifier) are practically unique identifiers for partitions, and not the device itself. That is partitions have a UUID, but the location of the MBR that grub-install
addresses does not have a UUID.
If you generate a UUID for the device (e.g.,uuidgen /dev/sdb
) you then encounter a device.map problem within GRUB. grub-mkdevicemap
fails to rectify the problem automagically.
If you grub-install /dev/disk/by-uuid/de305d54-75b4-431b-adb2-eb6b9e546013
, for example, you will receive errors like
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. <blah, blah, blah>
...and so it goes.
More info can be found https://unix.stackexchange.com/questions/174206/warning-file-system-ext2-doesnt-support-embedding-but-my-system-isnt-emb
This was a fun experiment. Thanks.
Did you try it? What were the results? – a CVn – 2015-02-05T09:42:25.250
I'm just trying it ... /dev/disk/by-uuid/XXX not would work as on my case, the hard disk alone not have a UUID. But /dev/disk/by-id/XXX looks that could work. nixos-rebuild dry-run don't output any error, so I would try it now. – Zardoz89 – 2015-02-05T18:15:00.730