Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have copied my /var /opt /usr directories to a newpartititon and now I need to configure the fstab file.

That is the new partition content:

drwxr-xr-x  6 root root  4096 Dec 20 12:16 opt
drwxr-xr-x 10 root root  4096 Dec  8 06:52 usr
drwxr-xr-x 11 root root  4096 Dec 21 08:35 var

This is how I want to change the fstab file:

# <file system> <dir>   <type>  <options>   <dump>  <pass>
tmpfs       /tmp    tmpfs   nodev,nosuid    0   0
UUID=00e31411-0730-9903-c038-45c4014ce600 / ext2 defaults 0 1
UUID=4bbbd587-1439-427b-9584-5b36d904f4c3 /home ext4 defaults 0 1
UUID=5a694838-c110-4eb9-9703-c490792af400 swap swap defaults 0 0
UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /var
UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /opt
UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /usr

Will the fstab file detect the subdirectories in each partition or should I put each directory in its own partition?

Since in my /home partition, there is the home's contents and not another home directory, I think that the above configuration wouldn't work, since in the new partition i have three separate directories.

What you think is the best way to do that via one partition ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

No, mount does not "detect" any directories under a filesystem. It is not its purpose.

If you put /var, /opt and /usr all on a one partition, which is not the root partition of your system, you'll need to do two things:

  1. Mount the partition under some separate, special directory - let's say /mnt/sysdirs
  2. Bind-mount the directories at their proper places in the root filesystem.

So the fstab in your case should look something like this:

tmpfs       /tmp    tmpfs   nodev,nosuid    0   0
UUID=00e31411-0730-9903-c038-45c4014ce600 / ext2 defaults 1 1
UUID=4bbbd587-1439-427b-9584-5b36d904f4c3 /home ext4 defaults 0 2
UUID=5a694838-c110-4eb9-9703-c490792af400 swap swap defaults 0 0
UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /mnt/sysdirs ext4 defaults 0 0
/mnt/sysdirs/opt   /opt  none bind,rw 0 0 
/mnt/sysdirs/usr   /usr  none bind,rw 0 0
/mnt/sysdirs/var   /var  none bind,rw 0 0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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