[lfs-support] What Is "The" LFS Partition?

Bruce Dubbs bruce.dubbs at gmail.com
Tue Nov 6 13:43:57 PST 2012


Feuerbacher, Alan wrote:
> Bruce wrote:
>
>>>>  From other recent reading I now understand that this whole scheme is
>>>> a kludge, and that's why it's not straightforward to understand.
>>>> I always wondered why there was a limit of four primary partitions,
>>>> and why there was even the notion of primary partitions, as opposed
>>>> to extended partitions, at all. The extended type is a kludge.
>>
>> When hard disks were first introduced, they were quite small.  I died
>> one that was 14 inches in diameter, 5 platters, and 3MB.
>
> When I worked as a student at MIT's AI lab back in 1979-1982, there
were two major computer systems on one floor of the building, a DEC-20 I
think, and something older. Each had a huge bank of disk drives
attached, each the size of a washing machine. Probably about 1MB of
storage each. :-) The two systems took up most of the floor space.
>
>> The original DR-DOS, that preceded MDS-DOS, set up the first 512 byte
>> sector as the boot sector.  It allowed four partitions.
>
> So it was a Bill Gates hack!

No, it was before that.  It goes back to at least CP/M.  I don't know 
about issues before that, but I suspect there were similar things in 
earlier systems.

>> Actually that's the first physical 512B sector.  The MBR starts 446
>> bytes into the sector and the last two bytes have the signature of
>> 0xAA55.

> Can you suggest any technical resources where I might learn the gory details of this?
>

Read the source:  Look in GRUB ./grub-core/boot/i386/pc/boot.S

>>> Why does one have to create a directory with that name before
>>> executing the "mount" command?
>>
>> The system has to know where to attach the data structures in the file
>> tree.  You could create a script to do a 'mkdir -p <mountpoint>;
>> mount...', but that's overkill.
>
> Now I'm confused again. I thought that creating a directory actually
writes data into a place on a hard disk that the kernel allocates for
the directory. Something about inodes, if I remember right. But if
that's so, and a filesystem is not yet mounted, where does that data get
written? It looks like the cart is before the horse.
>
> Specifically, if you want to do "mount /dev/sda5 /mnt/lfs", but you
have to create the directory "/mnt/lfs" BEFORE you do the mount, then
where does the inode information about "/mnt/lfs" get written? I'm sure
I'm missing some details.

Every directory is written in the inode structure of it's parent.  This 
is implemented using hard links.  To learn about this you really need to 
read a book about the kernel internals.  I really don't want to look up 
all the details.  You might want to read something like:

http://www.amazon.com/The-Linux-Kernel-Book-Card/dp/0471981419

Look on ebay for a much lower price.  It's old but the concepts are valid.

>>>> I now find it much easier to just have the whole system on one
>>>> partition.
>>>
>>> Easier mainly because you don't have to create a lot more partitions?
>>
>> Easier, but less flexible.  Being able to mount things like /home or
>> /boot allows much better sharing between different builds/distros.
>
> So what would you suggest for a machine that would ultimately be
> home
to several distros, LFS and Windows, using GPT? Perhaps something like
this (following the names from my own GPT installation)?
>
> +-----------------------------------
> |  /dev/sda
> |  +--------------------------------|---|
> |  |  1    BIOS boot                    |
> |  +--------------------------------|---|
> |  |  2    Microsoft                    |
> |  +--------------------------------|---|
> |  |  3    Linux swap                   |
> |  +--------------------------------|---|
> |  |  4    /                            |  LFS,BLFS,etc
> |  +--------------------------------|---|
> |  |  5    /usr                         |
> |  +--------------------------------|---|
> |  |  6    /opt                         |
> |  +--------------------------------|---|
> |  |  . . . .                           |
> |  +--------------------------------|---|
>
> |  +--------------------------------|---|
> |  |  . . . .                           |  Distro 1
> |  +--------------------------------|---|
>
> |  +--------------------------------|---|
> |  |  . . . .                           |  Distro 2
> |  +--------------------------------|---|
>
> |  +--------------------------------|---|
> |  |  . . . .                           |  Windows
> |  +--------------------------------|---|
> +-----------------------------------
>
> The partition numbers could go into the dozens.

I'd change /usr to /home, otherwise it's OK.

I only have 17 on sda, 7 on sdb and 2 on sdc.

   -- Bruce




More information about the lfs-support mailing list