A question about /etc/mtab (and partitioning)

Subject: A question about /etc/mtab (and partitioning)
From: Kurt Welgehausen (kaw@AbacusRT.com)
Date: Mon Sep 04 2000 - 14:02:49 MDT


You should NEVER edit /etc/mtab. The correct file is /etc/fstab.

You don't want to mount your new partition directly on /home
because then all the data in /home would be inaccessible. Here's
what you have to do (as root):

If it doesn't exist already, use mkdir to create a directory
called /mnt. If something, such as a cd-rom, is already mounted
on /mnt, unmount it or choose a different name, such as /mnt2.
Now you can mount your new partition on /mnt (mount -t ext2
/dev/hda6 /mnt). If you didn't format hda6 when you created it,
you should format it before you mount it (mke2fs -c /dev/hda6).

Now cd to /home, and run this command: find | cpio -pdm /mnt.
This copies all the data in the /home directory tree to /mnt.
(To find out how it works, run find | less, and read the man page
for cpio.)

When you're sure that all the data have been copied correctly to
/mnt (hda6), you can delete everything in the old /home tree by
running rm -r /home/*. This will release the disk space on hda7
(root partition).

Now you can add the new partition to /etc/fstab. The correct
line is '/dev/hda6 /home ext2 defaults 1 2'. Be sure that this
line is somewhere after the line that mounts the root partition;
you can just add it to the end of /etc/fstab. Now when you
re-boot, /dev/hda6 should be mounted automatically on /home.

After you've done this, you cannot move anything from /usr, or
from any other directory on the root partition, to the new
partition because the paths would be wrong. The new partition
begins at /home, so if you moved /usr/lib to the new partition,
the new path would be /home/usr/lib, and nothing would work.

If your /home directory tree is not very big, it might be better
to move /usr/lib or /usr/share (in stead of /home) to hda6. You
can see how much space a directory tree is using with du, e.g.,
du -sm /usr/lib. Just substitute '/usr/lib' or '/usr/share' for
'/home' in the procedure above.

Before you do any of this you should read the man pages for all
the commands and be sure you understand what they do and that the
options are correct.

Good luck.

This archive was generated by hypermail 2a24 : Mon Sep 04 2000 - 14:07:38 MDT