How can I know from which partition I had booted?
Once GRUB has handed off booting to the kernel, the kernel has no idea what started it, and /boot
might not be the one which that GRUB used. You might check the access times of boot/grub/grub.cfg
in each of the partitions to see which one was most recently accessed. That could tell you which partition's configuration file GRUB used.
stat -c %x /boot/grub/grub.cfg
If the access times aren't updated, you'll have to look for any differences in the kernel parameters used by the various GRUB configuration files. If you can change them, for example, add foo=1
, foo=2
, etc. to GRUB_CMDLINE_LINUX
in each of these, run sudo update-grub2
and reboot, then you can check /proc/cmdline
to see which of these values were used.
As you know the file you are looking for is located in /boot
directory of your running system. either /boot
is a separate partition or it's not;
If your /boot
is a separate partition you should look for that:
$ lsblk -r | grep '/boot'
sda2 8:1 0 400M 0 part /boot
Means the grub.cfg
which been used is located in sda2
.
Othewise you should look for root
:
$ lsblk -r | grep '/$'
sda1 8:1 0 121.2G 0 part /
this time it's located in sda1
.
Or even for fun we can check boot time parameters:
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-686-pae root=UUID=938495-1fe2-3302 ro quiet
then use UUID
to find out which partition is your root.
$ sudo blkid | grep 938495-1fe2-3302
/dev/sda1: UUID="938495-1fe2-3302"
Which means from sda1
.
You can also check for these boot parameters to see which one of your grub.cfg
files contains them, this only works when your boot parameters in grub.cfg
are differ from each other.