Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
root partition / mounting directly after creating partitions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
learning_unit
n00b
n00b


Joined: 20 Apr 2017
Posts: 2

PostPosted: Thu Apr 20, 2017 7:01 pm    Post subject: root partition / mounting directly after creating partitions Reply with quote

Quote:
Now that the partitions are initialized and are housing a filesystem, it is time to mount those partitions. Use the mount command, but don't forget to create the necessary mount directories for every partition created. As an example we mount the root partition:

root #mount /dev/sda4 /mnt/gentoo


-> https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks


I'm planning on creating:
- EFI system partition (/boot/efi)
- partition for packages (/usr)
- partition for user data (/home)

What is a "root partition"?
Why is /mnt/gentoo suggested?

What is suggested for the other partitions, if not what I put in parenthesis?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3150

PostPosted: Thu Apr 20, 2017 7:23 pm    Post subject: Reply with quote

/mnt/gentoo is suggested for installation process only. You can't just toss your files out of the bucket and hope for them to find their places on your hard drive. So, you create a partition, then mount it under /mnt/gentoo, and then put your files on top of /mnt/gentoo.
After you reboot, your initial environment is gone, but the files are still on your partition. And that partition (former /mnt/gentoo) becomes your root directory. The one denoted with a single slash. Root is pretty self-descriptive name: this is the base of your system. If you want to access some other filesystem, you have to mount it somewhere, just like you mounted an empty partition under /mnt/gentoo earlier. Of course the mountpoint will vary depending on it's purpose. E.g. you can expect to find bootloader's files and kernel under /boot. If you have a separate boot partition, this is the correct place to mount it when you update your kernel.
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Thu Apr 20, 2017 8:32 pm    Post subject: Reply with quote

One point of confusion for some users is that "root" is ambiguous. After awhile, one learns to notice, from context, if the reference is to "/" or to "/root"

During the install process, what will become the "/" root directory is mounted at /mnt/gentoo This choice of name is only to make it easily identifiable as a "not running" but "to be in the future" gentoo. Any otherwise unused directory name could be created and used. One could create "/gentoo" and mount there, or "/home/gentoo", or literally ANY other place. /mnt is customarily used to denote mounting of anything outside of the running operating system.

After mounting a partition at /mnt/gentoo, AND CREATING MOUNT POINTS FOR ADDITIONAL DIRECTORIES, AND CREATING FILESYSTEMS ON THE NEW PARTITIONS, any further or additional partitions for the "gentoo under construction" are mounted at points that are built into the root directory (partition/filesystem) mount point of the "gentoo under construction" , e.g., /mnt/gentoo/boot

Using the partitioning scheme that is in place, generally, here ...

Code:
# Prepare the empty partitions by creating empty filesystems
mkfs.ext4 /dev/sda6
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda7
mkfs.ext4 /dev/sda8

# Make a place to mount what will the the "/" root of the new install
mkdir /mnt/gentoo

# Mount a filesystem on what will be the "/" root of the new install
mount /dev/sda6 /mnt/gentoo

# Make mount points ON the "/" root filesystem of the new install
mkdir /mnt/gentoo/boot
mkdir /mnt/gentoo/usr
mkdir /mnt/gentoo/home

# mount the partitions for the new install
mount /dev/sda3 /mnt/gentoo/boot
mount /dev/sda7 /mnt/gentoo/usr
mount /dev/sda8 /mnt/gentoo/home

# Check your work
df
Back to top
View user's profile Send private message
dpaddy
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jun 2008
Posts: 142

PostPosted: Thu Apr 20, 2017 10:01 pm    Post subject: Reply with quote

> What is suggested for the other partitions, if not what I put in parenthesis?

Apologies if I misinterpret the above... but it and the context in which it appeared suggest (to me) that you may be interpreting "partition" as the root of some subtree in a filesystem hierarchy. Files appear in directories, and directories can also appear in directories... for an oversimplified analogy, think of a Matryoshka doll (https://en.wikipedia.org/wiki/Matryoshka_doll) where the innermost doll is a file and the other dolls are directories (the difference is that may files and many directories can be within a directory), the outermost doll -- the one which contains all the rest -- is the root directory.

The "containment" relationship between files and directories, or between directories and directories (I use mathematical "or" not exclusive or), is organized as a tree (things can be more complicated, but this is a reasonable conceptual starting point); one often thinks of the root directory as the top of a tree which grows downward (https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Binary_tree.svg/330px-Binary_tree.svg.png); children of a node (directory) are the files and directories which it contains.

A partition is conceptually a part of a disk; you can split a disk into several parts, each being a partition (things can actually be more complicated, but this is a reasonable conceptual starting point). Data (i.e., bits -- most everything besides hardware is data in the sense that it is bits) lives on your hard drive, thus data is in some partition. The root partition is the part of your disk which contains the root directory.

Things can (do, and are) more complicated, but the simplest case is that a partition contains a filesystem organized as a tree. Mounting a partition on a node (directory) within the root directory redefines that node to be the tree (filesystem) which the partition contains... the tree representing the partition's file system becomes a subtree of the root directory. You don't need a separate partition for the children of the root directory (and if you do mount several partitions to make their file systems avalable as children of the root directory -- like /usr, /etc, /var -- that can complicate matters related to booting and system rescue). There are advantages/disadvantages to getting more complicated, but reasonable advice is to follow the installation guide and KISS. In that case, the statement
Quote:
but don't forget to create the necessary mount directories for every partition created.
can be largely ignored, because you will find that when you extracted the stage3 tar ball, the mount directory for /dev/sda2 (/boot) and /dev/sda4 (/) were already created (/dev/sda3 does not need a mount directory because it is disk swap space).
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Thu Apr 20, 2017 10:56 pm    Post subject: Reply with quote

If one does not create the "/mnt/gentoo/usr" directory, and mount a separate partition there before extracting the stage3 tarball, the (./usr/*) contents of the stage3 tarball won't be created on a separate partition that is later mounted at /mnt/gentoo/usr
Back to top
View user's profile Send private message
learning_unit
n00b
n00b


Joined: 20 Apr 2017
Posts: 2

PostPosted: Fri Apr 21, 2017 5:52 am    Post subject: Reply with quote

Processing input.
Thank you educators!
Back to top
View user's profile Send private message
okasaan
n00b
n00b


Joined: 07 Mar 2021
Posts: 2
Location: 제주도 [Jeju]

PostPosted: Mon Mar 08, 2021 6:54 pm    Post subject: Thank you Reply with quote

cboldt wrote:
One point of confusion for some users is that "root" is ambiguous. After awhile, one learns to notice, from context, if the reference is to "/" or to "/root"..


2021: And this was so helpful and its starting to explain where I must have made earlier mistakes on my set up. Thank you
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum