Solved

mounting using mtab

Posted on 2004-04-29
4
991 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
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now