moving some directories to the New partition but still preserving the links

Rick Stevens rstevens at vitalstream.com
Wed Feb 23 17:13:58 UTC 2005


bj wrote:
> Hi !
> 
> I have Red Hat 8 on a intel P 4 machine with 512 MB memory .
> 
> Thanks to all , I was able to partition my 60 GB hard drive creating
> extended drives .

"extended drives"?  Eh?  Do you mean partitions in the extended
partition (partition numbers > 4)?

> Now I want to move some of directories under my root to my extended
> partition that has already been formatted with mkfs.ext3.
> 
> I have got the procedure to move  /tmp and /var to their own shared
> partition .

/tmp and /var are root mountpoints.  Unless you have a partition you're
using for /var, mount /var, "mkdir /var/tmp", then "rm -rf /tmp; ln -s
/var/tmp /tmp", I can't see how you can share a partition for /tmp and
/var.

> I want to move /usr , /applications , /backup  , /home , misc , /proc , /tmp
> .
> 
> I want to mount /dev/hda5 as /usr & /dev/hda6 as /home or what ever most
> suitable .

Fine.

> But my greatest worry is how to make sure that the previously installed
> applications work after the move .

They should work fine.

> How to preserve the symbolic & hard links as files are moved across
> different partitions.

It's rather dependent on how you created the symbolic links.  If they're 
relative (i.e. they don't start with a "/"), then they should migrate
just fine.  Even most that have absolute paths (starting with a "/")
should be fine.  You only run into issues with absolute paths if the
root of the path ceases to exist.

Hard links are another matter.  Hard links cannot span file systems, so
if a hard link references a file on another filesystem, you're SOL.  You
will have to redo it as a symbolic link and that may break some
applications (IMHO an app that depends on a hard link should be tossed
out anyway).

> Please advice if it is possible to do a successful move of some of the
> directories under / and still preserve the links and make the applications
> work.

Without knowing which applications you're speaking of, we can't say.
The odds are that you'll be fine.  The vast majority of systems have
separate partitions for /, /usr, /var and /home.

> Thanks in advance ,
> 
> cheers,
> bj
> 
> 
> 
> My root directory structure is as ffs :-
> 
> 
> applications
> backup
> bin
> boot
> dev
> etc
> home
> initrd
> lib
> lost+found
> misc
> mnt
> opt
> proc
> root
> sbin
> tftpboot
> tmp
> usr
> var

Pretty normal, except for the "applications" and "backup" directories.
NOTE: You can't move "/proc", as it doesn't contain "real" files.  It
is a virtual filesystem, created by the system on the fly.

Don't move /dev either.  Actually, I'd recommend not moving any of the
following:

	/bin
	/boot
	/dev
	/etc
	/initrd
	/lib
	/lost+found (well, it's created by "mke2fs")
	/mnt
	/proc
	/tftpboot

I'm lukewarm on moving /tmp.  You can, but it shouldn't get very big.
Putting /usr, /var and /home on separate filesytems is a good idea.
/var shouldn't get too big.  The biggest space suckers on /var are the
logs (/var/log) and the yum cache (/var/cache/yum, assuming you use yum,
of course).
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-            "You think that's tough?  Try herding cats!"            -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list