Renaming Directories

Michael Pelletier mvpel at hushmail.com
Tue Sep 23 16:34:24 EDT 2008


Renaming directories with "mv" when both the source name and target name are
on the same filesystem works as expected - the name of the directory is
changed within the filesystem and no change is made to the contents.

However, if /mnt/store and /mnt are two separate volumes - sda & sdb, for
example - then going from /mnt/store to /mnt/store.old means that the entire
contents of the /mnt/store filesystem have to be moved from one volume to
the other.

If /mnt/store is a mountpoint, the easy way to change the name is to unmount
the filesystem and remount it on a renamed mountpoint - umount /dev/sda;
mkdir /mnt/store.old; mount /dev/sda /mnt/store.old ... Same idea as with
"mv" on a single filesystem - you're changing the label for the directory,
not the contents.

	-Michael Pelletier.

-----Original Message-----
From: gnhlug-discuss-bounces at mail.gnhlug.org
[mailto:gnhlug-discuss-bounces at mail.gnhlug.org] On Behalf Of Bruce Labitt
Sent: Tuesday, September 23, 2008 3:30 PM
To: GNHLUG
Subject: Renaming Directories

Simple question here.  Say I want to rename /mnt/store to /mnt/store.old.  I
could of course do this with cp, however, I don't have enough disk space.
So is there a way that just does a rename of the directory?
# mv /mnt/store mnt/store.old would create a new directory full of files,
wouldn't it?

-Bruce
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss at mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/





More information about the gnhlug-discuss mailing list