1

From LFS instructions: http://www.linuxfromscratch.org/lfs/view/stable/chapter02/mounting.html

If using multiple partitions for LFS (e.g., one for / and another for /usr), mount them using:

mkdir -pv $LFS
mount -v -t ext4 /dev/<xxx> $LFS
mkdir -v $LFS/usr
mount -v -t ext4 /dev/<yyy> $LFS/usr
Replace <xxx> and <yyy> with the appropriate partition names.

I can't seem to understand the concept of mount point being a random directory. In this case LFS=/mnt/lfs

1 Answer 1

2

A filesystem is really just a big array of bytes stored (typically) in a partition. Mounting is how you get access to the files within it.

Every filesystem has its own root directory. In Windows, you have drive letters (like C:) that refer to the root directories of different filesystems, but Unix and Linux use a different approach. There's a single "virtual" directory hierarchy, but any directory can be used as a mountpoint for the root of another filesystem.

So when you mount your new filesystem on /mnt/lfs, it makes /mnt/lfs be an alias for that filesystem's root directory — think of it as a sort of fancy drive letter. As you follow the LFS instructions, you'll be creating subdirectories like bin and etc in there, and they're actually being placed under the root of the filesystem you created. Later, when you boot your finished LFS system, that same filesystem will be mounted as the root filesystem (/), so its contents will appear as /bin, /etc, and so on.

There's nothing special about the path /mnt/lfs. You could've called it /mnt/foo or /foo/bar or whatever. All that really matters is that you have a path that refers to the root of your newly-created filesystem so that you can start copying things into it.

3
  • Thanks. But why they added the extra directory instead of just calling it /lfs or /mnt ?
    – BluePython
    Jul 24, 2014 at 7:06
  • /mnt is the traditional place to mount filesystems that don't "belong" somewhere else (such as /home), and creating new top-level directories is discouraged, so that's why /lfs isn't used. It'd be fine to just use /mnt, but then if you wanted to mount something else at the same time, you'd have nowhere to put it. Creating subdirectories in /mnt means you have places to put any number of filesystems.
    – Wyzard
    Jul 24, 2014 at 12:54
  • Awesome thanls. A related but slightly different question is: what is the purpose of mounting and unmounting it when you are not really using it (i.e. you are booting from a different OS when "creating" this new filesystem or OS? It should not affect it when you change files there) ..I used to think mounting was similar to booting... I was obviously wrong, but the question is what is the purpose of those options.
    – BluePython
    Jul 24, 2014 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.