?
Solved

mounting using mtab

Posted on 2004-04-29
4
Medium Priority
?
1,002 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 400 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 140 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

777 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