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

Feuerbacher, Alan AFeuerbacher at ALLEGROMICRO.com
Tue Nov 6 12:21:37 PST 2012

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!

> The scheme has
> been modified over the years with backward compatibility in mind. Now,
> it just can't be modifified any more and for 2T drives and still keep
> backward compatibility.  It's time to throw away the buggy whip.

I agree.

> >> When the "mount" command is used on a block device (e.g. "mount
> >> /dev/sda7 /mnt"), it looks at the first few bytes for those "magic"
> >> values, to figure out which type of filesystem is there. It then
> >> instructs the kernel to interpret the block device as a filesystem
> of
> >> a certain kind.
> 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?

> > So "mount" essentially associates a physical location in a particular
> > partition (say, the first few magic bytes of /dev/sda7) with a
> > directory name ("/mnt"), no?
> A bit more than that.  It has to set up data structures and do some
> other initialization.

Ok, so mounting IS a lot more than just a way of looking at things. It's doing something *physically*. That clears up a lot.

> > 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.

> >> Suggestion: Do not play with LVM until you understand the basics!
> >
> > But LVM is touted as being easier to deal with than the older system.
> > Is that not the case?
> No it's not.  At least in the beginning.  It's rarely needed outside a
> large installation where disks are being added and removed all the
> time.
> Large distros what to do things 'one way', so they use it by default
> even though it only provides a benefit to a relatively few users.

I see. So that's why Fedora 17 uses that system.

> I'd just use GPT and then use mkfs on the partitions created.  You only
> need a bios_partition on the drive you will boot from.


> >> 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.


More information about the lfs-support mailing list