Solved

mounting using mtab

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get maximum transfer speed over LAN 4 103
android secure ftp 3 50
centos commands 6 67
How to change the nameserver on Ubuntu Server 6 48
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Fine Tune your automatic Updates for Ubuntu / Debian
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

792 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