LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-11-2009, 02:01 PM   #1
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 42

Rep: Reputation: 15
How to get partition info from within GRUB ?


Hello All,

I have a question about GRUB.
I am trying to configure a GRUB instance to boot a DSL installation
on a partition on my hard drive.

I thought I know how GRUB sees and labels partitions,
but when I try to boot, it gives me all kinds of error messages.

I am trying all the partitions I can imagine,
but nothing works.
I can easily see the partitions on the hard disk
by using all kinds of linux live cd's: DSL, Puppy, Knoppix
but the naming convention is linux standard and not GRUB standard.

Is there a way to get a text description of what GRUB actually sees ?
from within GRUB ?

I am able to boot to GRUB and play with its command line,
but I didn't find a command that will do the above.
I wonder if I am missing something ?
Or perhaps such a command does not exist ?

Any help appreciated.

Babypeng
 
Old 03-11-2009, 02:10 PM   #2
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
How do try to put it in youŕe menu.lst ?
Remember GRub start counting with a Zero = 0 so it starts with (hd0,0)
 
Old 03-11-2009, 02:14 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
If you start in the MBR, all that grub knows is where to find its config. file---typically /boot/grub/menu.lst. From the config. file, I assume that grub then looks in the partition table to find the appropriate partition.

In the MBR (1st sector on the drive), you have:
Boot code (eg GRUB stage 1): 446 bytes
Partition table: 64 bytes
Signature: 2 bytes
TOTAL: 512 bytes
 
Old 03-11-2009, 02:21 PM   #4
hurry_hui
Member
 
Registered: Oct 2008
Location: Near Jakarta
Distribution: Slackware, Arch, Slax, Porteus, Tiny Core, Slitaz
Posts: 355
Blog Entries: 1

Rep: Reputation: 51
Do u mean this Command?: geometry drive [cylinder head sector [total_sector]]. E.g. Geometry (hd0)

Last edited by hurry_hui; 03-11-2009 at 03:06 PM. Reason: To give example
 
Old 03-11-2009, 04:03 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,870

Rep: Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248
What type of information are you looking for? The geometry command hurry_hui suggested will give you the filesystem type and (ext2, reiser, ntfs...) and the partition type (0x83:Linux; 0x7:ntfs...)
 
Old 03-11-2009, 04:47 PM   #6
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
Can you please detail:

1/ What error messages are you getting exactly.

2/ You said you tried several things, please show us what you tried.
 
Old 03-12-2009, 03:42 PM   #7
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 42

Original Poster
Rep: Reputation: 15
when using the "geometry" command, I have to write the partition's name (hdx,x)
in the command, so I have to know my partitions name - so it's not what I am looking for.
I want grub to look and tell me which partitions are there.

I tried writing different partitions names in the line "root (hdx,x)"
on a GRUB stanza, and then boot it.
When using the GRUB way of naming partitions I wrote "root (hd0,1)"
because I thought that's where my linux installation should be.
I installed linux on the 2nd partition - ext2 ,
right after my winXP ntfs partition.
But it says it can't identify the file system, and can't mount it.
After loosing any hope I tried all kinds of possibilities,
until I got to the ext2 filesystem at (hd1,1),
but I on;y have a single hard disk, so how did grub got to a second partition
of a second HD ?

I would like to see what grub sees and I wonder if there is
a grub command that can show it to me.

Any help appreciated.

Babypeng
 
Old 03-12-2009, 03:45 PM   #8
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
I have never had to enter the geometry command. Grub figures it out on its own usually.

Grub does have auto-complete.

so if you do

root(hd0,

and press TAB it will list the available partitions and their types

after that you can enter the other commands and type boot to try it out.
 
1 members found this post helpful.
Old 03-12-2009, 04:02 PM   #9
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,870

Rep: Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248Reputation: 1248
Quote:
when using the "geometry" command, I have to write the partition's name (hdx,x)
in the command, so I have to know my partitions name - so it's not what I am looking
You don't need the partition name, just the drive. EX:

grub> geometry (hd0)
drive 0x80: C/H/S = 38792/16/63, The number of sectors = 39102336, /dev/hda
Partition num: 0, Filesystem type is fat, partition type 0xb
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 3, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7

The above shows output of my first hard drive (hd0) with fat partition, 2 Linux and one ntfs.

Quote:
but I on;y have a single hard disk, so how did grub got to a second partition
of a second HD ?
Have you ever had another drive, even usb on the computer? If not, I don't know how Grub would show (hd1,1).
 
Old 03-13-2009, 01:49 AM   #10
hurry_hui
Member
 
Registered: Oct 2008
Location: Near Jakarta
Distribution: Slackware, Arch, Slax, Porteus, Tiny Core, Slitaz
Posts: 355
Blog Entries: 1

Rep: Reputation: 51
This is interesting. What is the output of fdisk -l ? I wonder. Any hidden partition? Hard drive mapping?

Last edited by hurry_hui; 03-13-2009 at 02:06 AM. Reason: Rewriting.
 
Old 03-20-2009, 08:12 AM   #11
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 42

Original Poster
Rep: Reputation: 15
Hello All,


The auto complete (TAB) is what I was looking for. Thank you x_terminat_or_3 .

Running the "geometry" command without the partition number,
just the drive number, also did the trick. Thank you yancek.

hurry_hui : There are no hidden partitions and no mappings.

yancek : I did have usb sticks stuck into the computer many times.
Actually the grub I was booting from is installed on a usb stick.

The whole issue started when I installed DSL on an ext2 partition
and tried to boot it.
After implementing what I learned from your posts,
I managed to get to the DSL bootup screen, but then it said something about
"Kernel Panic", and about dropping me "to a very limited shell"
on which the only thing I can do is hard reset the machine.

I did some reading about it and learned it has to do with
"initrd" and with compiling the kernel.
I came to the conclusion it is too complicated
for my current level of knowledge, so I will switch to Puppy.

Thank you for your responses.


Babypeng
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Messed up my MBR, now GRUB and Extended Partition Info lost Q-Continuum SUSE / openSUSE 16 05-07-2007 03:29 AM
Some info on Grub... tcrew Linux - Newbie 8 01-12-2007 11:25 AM
partition info batto Linux - Newbie 2 05-05-2006 05:56 AM
Partition Info fzx1 Linux - Newbie 3 04-07-2004 02:03 PM
Partition info help BamaFeva Linux - Newbie 5 10-28-2002 12:12 PM


All times are GMT -5. The time now is 10:53 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration