This is a simple way to tell if GRUB is installed. If it doesn't work your file
command's database is likely out of date and you can either update the its database or use an alternate method from another answer.
You can use file
to identify GRUB in an MBR. e.g.
# file -s /dev/sda
/dev/sda: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3
, stage2 address 0x2000, stage2 segment 0x200; partition 1:
ID=0xfd, starthead 1, startsector 63, 1044162 sectors; partition
2: ID=0x82, starthead 0, startsector 1044225, 1028160 sectors;
partition 3: ID=0xfd, starthead 0, startsector 2072385,
1951447680 sectors, code offset 0x48
The root=
paramater is not stored in the MBR, that's stored in GRUB's menu.lst
file which is stored on a file-system (typically in the /boot/grub directory of the root fs or the grub directory of the /boot filesystem - but not always, it could be anywhere).
You'll have to parse the output of file above, determine which disk/partition the menu.lst
file is on, mount it, read it in and parse it. You'll also want to read in the grub/default file to figure out which grub menu entry is the default, because that's probably the one that has the root= parameter that you're most interested in.