LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 10: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, 10:13 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
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, 05: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, 07:00 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,842

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
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, 05:17 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,388

Rep: Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199
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, 05: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,200

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
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


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


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