LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-25-2010, 09:07 PM   #1
bala1486
LQ Newbie
 
Registered: Mar 2010
Posts: 7

Rep: Reputation: 0
How does kernel know the root directory?


Hello All,
I have a question on how the kernel knows the root directory. For example, in grub menu.lst file we specify root=/dev/hda1. This tells the kernel to find mount the root directory from /dev/hda1. But to read /dev/had1 it should first know where is '/' . I couldn't understand how this is being done. Could anybody please explain me?? Thank you....

Thanks,
Bala
 
Old 03-25-2010, 09:13 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
My understanding, which could be wrong, is that when you install grub, it puts a hard link into the MBR (Master Boot Record) to the /boot directory that grub will use. During boot, it queries the menu.lst file, as well as the device.map file, and from them decides where "/" is. Alternatively, if you use disk labeling, then it will search for the disk with the label specified in menu.lst and that will be "/".
 
Old 03-26-2010, 04:43 AM   #3
kevmcool
Member
 
Registered: Dec 2009
Location: London
Distribution: CentOS
Posts: 36

Rep: Reputation: 15
does the line in grub.conf
kernel /vmlinuz................ root=/dev...............
tell the kernel where the / is
root
 
Old 03-26-2010, 06:00 AM   #4
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
Have a read of this for some background. Very handy site.
If that leaves unanswered questions, you always have the source to refer to.
 
Old 03-26-2010, 04:17 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
My thinking would be that by "mounting as root" a partition, no matter where you have the partition, would be root. So that any partition could be mounted as /root
 
Old 03-26-2010, 04:42 PM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
isn't it defined by fstab, which is created on install?
eg:
Code:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda2 during installation
UUID=44169a1f-a1aa-476a-9837-48ccb9853381 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=d43e0044-5a1d-4f17-abc3-c6fd77b20dd7 /boot           ext4    defaults        0       2
# /media/music was on /dev/sdc1 during installation
UUID=11aed5b6-5aa7-4f51-85a6-99017cb89c09 /media/music    ext3    defaults        0       2
# /media/stuff was on /dev/sdb2 during installation
UUID=bbe33dc3-0a1d-43cb-8874-c907b4954129 /media/stuff    ext3    defaults        0       2
# /media/videos was on /dev/sdd1 during installation
UUID=8f115647-e644-4bb4-a250-8cc42fbbe186 /media/videos   ext3    defaults        0       2
# swap was on /dev/sdb1 during installation
UUID=8f14d31e-7c39-40ef-ba63-76ef5ad0426f none            swap    sw              0       0
/dev/scd1       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
sshfs#user259713@172.16.0.21:/home/user259713/backend /mnt/modules fuse user,noauto 0 0
sshfs#user874-3985@172.16.0.22:/home/user874-3985/www /mnt/website fuse user,noauto 0 0
 
  


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
Deleted /root directory pix9 Linux - General 4 03-01-2010 11:23 PM
restoring desktop directory in /root (or any home directory) mel_lai Linux - Newbie 3 02-04-2008 03:13 AM
Root Directory fosiul Linux - Server 5 06-20-2007 02:41 AM
Can you only install on root directory? Eradicator Linux - Newbie 9 10-30-2003 10:16 AM
looking up my root directory isaacais Linux - Newbie 3 12-19-2002 06:35 AM

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

All times are GMT -5. The time now is 10:42 PM.

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