highlevelnamechanges

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: How do you change a directories name? (Feeling stupid)
From: "Steve \"Stevers!\" Coile" <scoile@redhat.com>
Date: Mon, 24 May 1999 17:41:10 -0400 (EDT)


On Mon, 24 May 1999 sgulick@poboxes.com wrote:
> I am sure it's easy to do but I can't seem to find reference to it
> anywhere. I want to change the name of the directory on my sdc1 partition.
> But how??

If you mean you want to change the directory under which /dev/sdc1 is
mounted, just edit /etc/fstab appropriately, then unmount and remount
the filesystem.

For instance, suppose /dev/sdc1 currently contains your home directories,
and is currently mounted under /home.  Suppose you've recently installed
a much larger drive for home directories, so you want to move the
existing home directories out of the way so that you can put the new
drive under /home.  Once the new drive is mounted under /home, you'll
copy the directories from the old partition to the new one and off you go.

First, boot everyone off the system so that they aren't trying to change
things in their home directories while you're making modifications.
The best way to do this is to reboot into single-user mode or run
level one.  To change to run level one, simply issue the command:

	exec telinit 1

Next, create a mount point for the old home directories, so that you can
maintain access to them while keeping the current mount point, /home,
available for the new drive.  We'll create /oldhome for this purpose:

	mkdir /oldhome

Next, unmount the current home directories:

	umount /home

Now modify /etc/fstab using your favorite text editor (vi, emacs, etc.).
Locate the line that references /home.  It might look something like
the following:

	/dev/sdc1	/home		ext2	defaults	1 1

Replace the default mount point for /dev/sdc1, /home, with the new mount
point we just created, /oldhome.  Then create another entry for the new
disk with a mount point of /home.  Let's suppose that the new device
is /dev/sdd1.  After making these changes, the original line would be
replaced with the following two:

	/dev/sdc1	/oldhome	ext2	defaults	1 1
	/dev/sdd1	/home		ext2	defaults	1 1

Note that the first one refers to the old partition and the second refers
to the new drive.

Exit the editor, saving your changes.

If you have not yet created a filesystem on the new drive, do so now
using the "mke2fs" command:

	mke2fs -v /dev/sdd1

Now you can mount both filesystems:

	mount /oldhome
	mount /home

Last step: copy the data:

	(cd /oldhome ; tar cflp - .) | (cd /home ; tar xfp -)

(You might also use cpio, dump/restore, or any of a variety of other
utilities to do the copy.  It's really a matter of personal preference.)

Once the copy is done, you can reboot the system and be on your way.
Later, after you're comfortable with the new drive, you can unmount
/dev/sdc1 from /oldhome, remove its entry from /etc/fstab, delete the
/oldhome mount point, and remove or reallocate the /dev/sdc1 partition
however you want.

===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu