Solved

mounting using mtab

Posted on 2004-04-29
4
995 Views
Last Modified: 2013-12-15
I have the following two lines in etc/mtab:

/dev/hda3 /home ext3 rw 0 0
/dev/hda2 /usr ext3 rw 0 0

hda2 has much more disk space than hda3, and I would like to mount /home on hda2 and /usr on /hda3. Is this a matter of simply changing the two lines above to the following and then restarting the system?:

/dev/hda3 /usr ext3 rw 0 0
/dev/hda2 /home ext3 rw 0 0

Additionally, it is not clear to me why Linux would assign by default much more space to /usr than /home. I am currently using /home for shared and archive directories, which is why I am needing more space. Is there any reason why I should /home/ or /usr, or even a different place altogether, for storing this kind of files? Is this merely an organizational issue or more than that?

Thank you.


Nick
0
Comment
Question by:Nickdane
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 10950091
You don't want to be changing /etc/mtab. That file is a record of what is mounted, it isn't used to do mounts. The file that designates what will be mounted is /etc/fstab.

Simply swapping the mounts of hda2 & hda3 will result in a non-bootable system because the contents of /usr won't be in the correct place. To swap usage of hda2 & hda3 will require a boot from alternate media and the moving of everything that is on hda2 to hda3 & vice versa. Then an edit of /etc/fstab will swap the partitions mount points. Depending on what Linux you are using it may also be necessary to change the file system labels.
0
 
LVL 12

Assisted Solution

by:paullamhkg
paullamhkg earned 35 total points
ID: 10956578
jlevie gave you the answer how to move/swap the /usr and /home

just explain in more detail which is get an extra storage media (normaly harddisk) add into your linux, and mount it and make a copy of your /home /usr into the new media, after copy change your /etc/fstab entry eg

if your new media is /dev/hdb1  /home and /dev/hdb2   /usr change the /etc/fstab as below

/dev/hdb1   /home   ext3    rw  0 0
/dev/hdb2   /usr      ext3    rw  0 0

so you now can reboot and let the linux to use the /dev/hdb as /home and /usr. after the system boot you can remove the stuff in /dev/hda3 and /dev/hda2 and copy the /home to /dev/hda2 and /usr to /dev/hda3, after copy complited, edit the /etc/fstab again as below

/dev/hda3   /usr    ext3   rw   0 0
/dev/hda2   /home ext3  rw   0 0

after change reboot now the /usr  /home swapped.

if you can get an extra Hard disk, I will suggest to make use of the new harddisk for your shared and archive.

/home is normally for user home directory where /usr for system application which will request more space by default.
0
 
LVL 12

Expert Comment

by:asidu
ID: 10967152

If you just want to make use of the area in hdb2...you could.

1 tar all the files in /home
2 untar all in /usr
3 Make sure all the directories and their rights are OK.
4 Create a soft link from home to the new /usr/home

hope that helps

@ma

 
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 10992679
forgot to said that while you copy across the files/directories you better to use the option -p to copy back all the attribut of all the files/directories and -R to include all the directories, read man page of 'cp' to get more idea (just 'man cp')
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question