What does mounting a drive on the /home directory do?
I am running a Rocks Cluster version of CentOS 6.5 and have two internal hard drives installed. When I installed the Rocks OS onto my machine it only made use of one of my two 250GB drives. I have formatted and partitioned the unutilized drive (/dev/sdb1) and would like to make the appropriate changes to my system configuration to make use of it. I was thinking of adding the following line to my /etc/fstab file:
/dev/sdb1 /home ext4 defaults 0 1But I have two questions regarding what making this change will do. Will this mean it will be mounted at boot up time by default? Will this mean that there will be 250 additional gigabytes that users can utilize in their own personal home folders? Thanks for any insight you can provide!
Edit: Additionally, what will happen if I never assign a partition to be mounted on directories like /opt, /tmp, /usr... Where do they get disk space from?
3 Answers
When you mount a filesystem, the space on that filesystem becomes accessible to users at the path on which it is mounted. So yes, users will gain access to 250 GB of extra space that is dedicated to /home.
Remember that mounting a filesystem renders any data otherwise located at the mount point inaccessible until it is unmounted, so make sure you move any existing files at /home (without /dev/sdb1 mounted), including permissions, to the new filesystem or users will not be able to access their data. (You might want to use a temporary mount point, like /mnt, to mount /dev/sdb1 so you can transfer files there from the existing /home.)
If no separate filesystem has been mounted for a particular directory or its parent directories, the data in that directory are stored in the root filesystem.
0I have formatted and partitioned the unutilized drive (/dev/sdb1)
That is not a drive. That is a partition.
/dev/sdb is the link to the whole drive.
/dev/sdb1 is the first partition on that drive. If you only have one partition then it is usually as large as the whole drive.
Compare it to having a book. sdb is the book. sdb1 are the pages for the first story in that book. And most books only have one story, in which case it is almost the same.
Question #1:
/dev/sdb1 /home ext4 defaults 0 1Will this mean it will be mounted at boot up time by default?
Yes. The first partition on that disk will be mounted at boot under /home. That assumes that you created an ext4 filessystem on that partition though.
Back to the book analogy: The filesystem is like actually writing the page numbers rather than having blank paper.
Question #2:
Will this mean that there will be 250 additional gigabytes that users
can utilize in their own personal home folders?No. This will replace whatever was stored under /home with the contents of the newly mounted filesystem.
Note that:
- This will be thr 250GB, not 250 additional GB
- Old content will not be accessible while the drive is mounted.
What you probably want to do is reboot into single user mode, then move the contents from /home to another location. (e.g. mv /home /home.old). Then mount the new disk in its old space (mkdir /home, mount /home) and make sure all old files and their permissions are then copied to the new disk.
Alternatively mount it under /home2 and move some users over.
Question 3:
What will happen if I never assign a partition to be mounted on directories like /opt, /tmp, /usr... Where do they get disk space from?
From the filesystem they are on. Just like almost all subdirectories / folders.
That is indeed what will happen. Keep in mind that data (directories, files and permissions) in the current /home directory should be moved prior to the first time you mount the new file system.