LinuxQuestions.org
Help answer threads with 0 replies.
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 12-29-2014, 06:33 AM   #1
sryzdn
Member
 
Registered: Feb 2013
Posts: 274

Rep: Reputation: 9
questions on /boot directory


Hi, I'm reading a text on linux partions and file systems, it says:
Quote:
Some versions of the Linux boot loaders cannot access a kernel that is
outside the first 1024 cylinders on a disk. By putting the /boot partition at the
beginning of the drive you can be assured of not having a problem when accessing
the kernel at boot. This problem shows itself most often in cases of dual booting
Linux along with another operating system that is on the first partition.
My question is: why a linux distribution may have "no access to the kernel outside the first 1024 cylinders" on a disk?

Also, what does "putting the /boot partition at the beginning of the drive" mean?

PS. The text is extracted from "LPIC 1 Certification Bible"
 
Old 12-29-2014, 07:01 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
This was a limitation of the BIOS and IDE drives years ago which is no longer a factor. Drives were divided into cylinders-heads-sectors which was used as an address to find data starting at zero. Cylinder 0 where the legacy MBR is located is the start of the drive. So creating a partition at the start of the drive is the beginning.

http://docs.freebsd.org/doc/3.3-RELE...os/limits.html

http://en.wikipedia.org/wiki/Cylinder-head-sector

Last edited by michaelk; 12-29-2014 at 07:03 AM.
 
1 members found this post helpful.
Old 12-29-2014, 07:10 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You are reading some OLD documentation.

This limitation goes back to old disk controllers that didn't implement logical block addressing, and instead used cylinder, head, sector addressing.

The problem wasn't with Linux, which didn't have any issues...

The problem was with the old BIOS in that it only used 16 bit numbers for addressing, so getting the right address would overflow the 16 bit value. Even then, getting it right involved tricks - like knowing that if you specified 64 heads, that the truncation (disks normally never had more than 16, and usually only 8... or 4) would still get the right head number (since it was always zero for the first head, and zero for the first sector)... but reduce the size of necessary cylinder to something it could handle.

Once the boot block is loaded, it was the loader that actually did the work - unfortunately, it still had to use the BIOS for I/O, so it had to remain with the clumsy limitations built into the BIOS.

Thus, keeping the cylinder to something less than 1024 would always work.


Now "putting the /boot partition at the beginning of the drive" is to place the boot loader into something under cylinder 1024... It was the original reason to have a /boot as a filesystem anyway - the entire partition had to fit in the first 1024 cylinders - cylinder 0, head 0, sector 0, through cylinder 1024, head <whatever the max number was>, sector <whatever the max was, usually 32>.

The result was that the master boot record (the MBR) was at the beginning of the disk (making it always cylinder 0, head 0, sector 0), and anything the boot program read from that block would also be readable by the BIOS disk input functions - thus putting the kernel file into the boot partition would make it available to the boot loader.

Last edited by jpollard; 12-29-2014 at 07:13 AM.
 
1 members found this post helpful.
Old 12-29-2014, 07:26 AM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
That limitation most certainly does not apply to GPT disks.

Here is my partition layout:
Code:
Model: ATA KINGSTON SV300S3 (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                 Flags
 3      17.4kB  1049kB  1031kB                  BIOS boot partition  bios_grub
 2      1049kB  103GB   103GB   ext4            Linux filesystem
 5      103GB   107GB   4293MB  linux-swap(v1)
 4      107GB   119GB   12.1GB  ext4            Linux filesystem
 1      119GB   120GB   536MB   fat32           EFI System           boot, esp
As you can see, the EFI system partition is at the very "end" of the disk and it boots just fine.

The BIOS boot partition can be placed anywhere within the first 2TiB of the disk and it should still boot in non-EFI mode (GPT disks only).
 
1 members found this post helpful.
Old 12-29-2014, 08:01 AM   #5
sryzdn
Member
 
Registered: Feb 2013
Posts: 274

Original Poster
Rep: Reputation: 9
Quote:
This limitation goes back to old disk controllers that didn't implement logical block addressing, and instead used cylinder, head, sector addressing.
yes, in LBA mode, each sector is assigned to a single unique number. But how can this unique number lead the firmware to read the correct head and cylinder?

Also, now that it is no longer the probem with BIOS and boot loader, what is the current role of /boot directory?

Last edited by sryzdn; 12-29-2014 at 08:09 AM.
 
Old 12-29-2014, 11:02 AM   #6
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by sryzdn View Post
what is the current role of /boot directory?
The /boot directory holds your kernel & initial ramdisk images.

In EFI systems, /boot (/boot/efi in most distributions) must be FAT formatted as it is read by the firmware and also contains the boot loader/manager and it's configuration files.

It can also be used to store the PK, KEK, db & dbx keys needed for Secure Boot if you have a signed kernel image & boot loader/manager.
 
Old 12-29-2014, 12:21 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by sryzdn View Post
yes, in LBA mode, each sector is assigned to a single unique number. But how can this unique number lead the firmware to read the correct head and cylinder?

Also, now that it is no longer the probem with BIOS and boot loader, what is the current role of /boot directory?
It now depends on the boot loader. The LILO loader read list of blocks to be loaded. Quite fast, but it depends on installing the boot loader each time you change the kernel. Grub knows about several filesystems. If you have grub you will see that the "stage 1.5" loader (grub legacy) has different filesystem support available. One of these is copied into the extended boot area of the boot disk. Grub2 does the same, though most of grub2 is now external to the /boot partition. This permits the boot loader to essentially, "mount" the filesystem and read from the disk according to the filesystem layout. This permits a more flexibility (at the cost of being a bit slower), and eliminates the need to reinstall the boot loader for each change. All that is needed is to put the kernel boot file in /boot, and adjust the grub configuration file. Since grub can follow the installed filesystem - it can read the necessary files.

Note, this still depends on the boot loader being able to read the filesystem that is used for /boot. It can't boot things it can't read - such as making /boot a ZFS filesystem (at least, not until a module has been written that would process it). It works fine for various ext filesystems, FAT, ... I understand it doesn't recognize btrfs yet).

One advantage to a separate /boot is that it becomes easy to make and restore backups.

One last thing - it isn't even necessary to have the /boot partition even mounted for the system to operate correctly. Once the kernel and initrd are loaded there isn't any need. Of course, if you are going to update the /boot files it will have to be mounted, but that is the only reason.

Last edited by jpollard; 12-29-2014 at 05:03 PM. Reason: one last thing
 
1 members found this post helpful.
Old 12-29-2014, 09:12 PM   #8
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
The head and cylinder concept is no more required to access hard disk drives. Instead every OS uses linear LBA sector addresses counted from zero to end.
 
  


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
[SOLVED] Directory permission questions MTK358 Linux - Newbie 6 03-03-2010 07:11 PM
Log file directory questions archer007 Linux - Newbie 2 12-02-2009 08:32 AM
directory questions Xris718 Linux - General 3 10-28-2005 03:03 PM
directory's questions codejungle Linux - Software 3 02-21-2005 04:06 PM
File & directory questions Joe47 Linux - Newbie 2 02-16-2003 01:29 AM

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

All times are GMT -5. The time now is 10:40 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