Solved

mounting using mtab

Posted on 2004-04-29
4
993 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
gdb doesn't stop on breakpoint 2 67
Remote desktop Ubuntu from Windows 10 5 59
android secure ftp 3 31
VMware Tools Install On Linux Problem 3 57
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

813 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

15 Experts available now in Live!

Get 1:1 Help Now