LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   which partition did i boot from? (https://www.linuxquestions.org/questions/linux-newbie-8/which-partition-did-i-boot-from-889289/)

bwanaaa 06-30-2011 09:41 PM

which partition did i boot from?
 
A bunch of drives exist on my system with a bunch of OSes. It's late at night and I forgot which partition i booted from. Is there an easy wy to figure this out? fdisk -l gives me all the partitions but how do i know which one i booted from?

andrewthomas 06-30-2011 09:48 PM

Quote:

Originally Posted by bwanaaa (Post 4400915)
A bunch of drives exist on my system with a bunch of OSes. It's late at night and I forgot which partition i booted from. Is there an easy wy to figure this out? fdisk -l gives me all the partitions but how do i know which one i booted from?

Code:

df -h
or just

Code:

cat /etc/fstab
if they use UUIDS you can then


Code:

ls -al /dev/disk/by-uuid/
to see which partition the uuid is linking to

Hevithan 06-30-2011 09:49 PM

Do you have Gparted? It shows graphically which OS is on what partition. Like when I look at Gparted on mine I see that /dev/sda1 is Dreamlinux, and it occupies a little over 20Gigs.
So if I am using Dream I know I am on sda1.

If you have it, it should be listed in Administration. Just click it and it should load the GUI. At least that is what I do.

Hope this helps, Good luck.

EDIT: Never mind, tried the df -h that andrewthomas posted and that is much quicker. :)

bwanaaa 06-30-2011 10:29 PM

tnx andrewthomas.

btw, i tried gparted but it doesnt say which parttion is the boot partition of the 12 that it sees on 2 hard drives and 2 usb sticks

andrewthomas 06-30-2011 10:39 PM

You are welcome.

Do you still seem to have a problem?

EDDY1 06-30-2011 11:18 PM

cat /etc/fstab would've done itr also as andrewthomas pointed out

flamelord 06-30-2011 11:34 PM

the mount command without any options shows what devices are mounted and where, so the device mounted at / should be the partition you mounted.

syg00 07-01-2011 12:42 AM

None of the answers provided address the question asked.
AFAIK there is no way to tell.

chrism01 07-01-2011 12:46 AM

Indeed; if you are multi-booting, then the current root '/' dir does not have to be on the disk or partition you actually booted from to start with ...

catkin 07-01-2011 12:47 AM

Unlike Windows, Linux does not make file system device names dependent on the boot file system so flamelord's answer is as good as it gets -- unless you want to know which MBR was executed and which file system was used by a boot manager such as GRUB or Lilo.

The OP question would be more meaningful under Windows where the system drive becomes C:. The question would be "Which partition is the C: drive on"?

EDDY1 07-01-2011 01:03 AM

I guess I'll ask a question.
If I use cat /etc/fstab doesn't it only tell you about specific mounts of that os?
I understand that you can add to fstab, but in my case fstab doesn't show windows os which resides on same hdd.

Inkit 07-01-2011 04:56 AM

Quote:

btw, i tried gparted but it doesnt say which parttion is the boot partition of the 12 that it sees on 2 hard drives and 2 usb sticks
I don't have as many drives, but I have a number of partitions in my comp. I've found that if I open gparted, and right click on all the different partitions, only the one that you are using as your / will NOT have a "Delete" or "Resize/Move" option highlighted. All the other partitions will have this option. Also if you try to unmount it, gparted will throw up an error.
I guess it's not the simplest way to do things, but if it helps.................

andrewthomas 07-01-2011 08:00 AM

Quote:

Originally Posted by bwanaaa (Post 4400915)
A bunch of drives exist on my system with a bunch of OSes. It's late at night and I forgot which partition i booted from. Is there an easy wy to figure this out? fdisk -l gives me all the partitions but how do i know which one i booted from?

I guess that I missed the point of the question.

You want to know about which bootloader loaded the OS that you are on.

Well, the best source of information about bootloaders is

http://bootinfoscript.sourceforge.net

It is best to run it from a LiveCD to be safe.

Fire up a LiveCD and navigate to the above link and post the results with your reply.

Then you can look at the output of

Code:

cat /etc/fstab
when you actually boot from a HD and know conclusively where you booted from.

Karl Godt 07-01-2011 08:00 AM

For multiboot I could think of the "uname [-r]" command and the "find" command to search for any "bzimage*" "-o -iname \"vmlinu*$KERNELVERSION*\"" .

Also to "grep" for the $KERNELVERSION in the "/boot/grub/grub.cfg" or menu.lst .

Grub actually loads the kernel .

[edit]
The boot_info_script.sh is quiet interesting 3000 lines long .
Note : needs to be "chmod 0755" to become executable .

Because I have 12 partitions on the main drive , I have 12 long menu.lst in the RESULTS.txt file .
Because I have a wrapper script for the mount command I can say for now : It mounts every partition and looks for kernels and grub-files .
Thanks for posting the link !
It is much more sophisticated , than the thoughts I posted .
[/edit]

syg00 07-01-2011 08:26 AM

Quote:

Originally Posted by andrewthomas (Post 4401314)
when you actually boot from a HD and know conclusively where you booted from.

Nope.
You can make some presumptions (as you have), but from a running instance of a system, there is no way to *know*.

It's even possible the instance wasn't booted from a partition at all - that is what kexec provides.


All times are GMT -5. The time now is 06:11 PM.