LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-30-2011, 09:41 PM   #1
bwanaaa
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Rep: Reputation: Disabled
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?
 
Old 06-30-2011, 09:48 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Quote:
Originally Posted by bwanaaa View Post
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

Last edited by andrewthomas; 06-30-2011 at 09:52 PM. Reason: added UUID info
 
Old 06-30-2011, 09:49 PM   #3
Hevithan
Member
 
Registered: Apr 2011
Location: Washington State
Distribution: Zorin5-(Ubuntu 11.04) // Backtrack 5-(Ubuntu 10.04) // Dreamlinux 3.5-(Debian)
Posts: 275
Blog Entries: 5

Rep: Reputation: 40
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.

Last edited by Hevithan; 06-30-2011 at 09:51 PM.
 
Old 06-30-2011, 10:29 PM   #4
bwanaaa
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
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
 
Old 06-30-2011, 10:39 PM   #5
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
You are welcome.

Do you still seem to have a problem?
 
Old 06-30-2011, 11:18 PM   #6
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
cat /etc/fstab would've done itr also as andrewthomas pointed out
 
Old 06-30-2011, 11:34 PM   #7
flamelord
Member
 
Registered: Jun 2011
Distribution: Arch Linux
Posts: 151

Rep: Reputation: 34
the mount command without any options shows what devices are mounted and where, so the device mounted at / should be the partition you mounted.
 
Old 07-01-2011, 12:42 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
None of the answers provided address the question asked.
AFAIK there is no way to tell.
 
Old 07-01-2011, 12:46 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 ...
 
Old 07-01-2011, 12:47 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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"?
 
Old 07-01-2011, 01:03 AM   #11
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
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.
 
Old 07-01-2011, 04:56 AM   #12
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
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.................
 
Old 07-01-2011, 08:00 AM   #13
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Quote:
Originally Posted by bwanaaa View Post
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.
 
1 members found this post helpful.
Old 07-01-2011, 08:00 AM   #14
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
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]

Last edited by Karl Godt; 07-01-2011 at 08:42 AM.
 
Old 07-01-2011, 08:26 AM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by andrewthomas View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shrinking the ext3 partition during the boot and creation of new partition saleem_ak Linux - Newbie 2 05-05-2009 01:52 AM
GRUB: How to boot WinXP (NTLDR, NTDETECT.COM & BOOT.INI) from boot partition (EXT2) ? Rayen16 Linux - Software 1 05-25-2006 12:09 PM
Messed up partition table and Windows' partition boot sector pyromithrandir Linux - General 32 04-08-2006 12:26 PM
Deleted linux partition, how to boot Windows partition? mysak Linux - General 3 12-14-2005 04:22 PM
strange partition table - boot partition empty etanter Linux - General 0 12-23-2003 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration