If you have grub
installed, run os-prober
as root. It does exactly what you want.
Update
os-prober
will only list operating systems other than the one it's on: it's used by GRUB during installation to generate grub.cfg
so it's natural that GRUB doesn't need info about the OS it's being installed on. To get the partition mounted as the current /
, you can do this:
ROOT_PARTITION="$(readlink -e -- "$(findmnt /|awk 'END{print $2}')")"
This will fail in the unlikely case that the partition mounted as /
has a space in its name.
References
sudo os-prober
, is that OK? – slm Aug 05 '13 at 21:53/dev/sda7
. As for Ubuntu itself, I found before it was on/dev/sda1
. Now that brings me to a different question: on/dev/sda6
I have my /home used by Ubuntu. How should I go about installing BT ? Can I move what's on/dev/sda6
to/dev/sda1
, or can I just partition it and then install a new OS ? Thank you for the help ! – Anas Aug 05 '13 at 22:48