DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Administering filesystems

Moving a subdirectory to another filesystem using symbolic links

Another way of expanding a filesystem is to use space located in another filesystem. This can be accomplished using symbolic links. For example, if you are running out of space on the root filesystem for an application data files directory, you can use space located on a secondary filesystem. As far as the application is concerned, the files will still appear to reside in the root filesystem.

The procedure described here moves a subdirectory to another filesystem and creates a symbolic link using this example:

Subdirectory name: subdir
Original location (path) of subdir tree: /usr
New location (path) of subdir tree: /d1


NOTE: The original filesystem must be of type EAFS, HTFS, or DTFS.

  1. Suspend operations on your system and bring it down to single-user mode.

  2. Make a backup of your system, and verify the backup to make certain it is valid.

  3. Manually mount the secondary filesystem(s).

    mount /dev/d1 /d1

  4. Get current permissions of /usr/subdir:

    ls -ld /usr/subdir

  5. Create the new subdirectory in /d1:

    mkdir /d1/subdir

  6. Change destination directory owner, group, permissions to match the original source:

    chown owner /d1/subdir
    chgrp group /d1/subdir
    chmod permissions /d1/subdir

  7. Copy /usr/subdir to /d1/subdir using these commands:

    cd /usr/subdir
    find . -depth -print | cpio -pdmv /d1/subdir


    NOTE: cpio(C) is used instead of a copy command to better retain permissions.

  8. Verify that the copy is successful:

    dircmp /usr/subdir /d1/subdir | tee /tmp/dirlog

  9. Create the symbolic link:

    ln -s /d1/subdir /usr/subdir

The procedure is now complete. Whenever you change directory to /usr/subdir, you will actually be in /d1/subdir (assuming filesystem d1 is mounted).


NOTE: Utilities that deal with the filesystem directory structure may not function as desired unless additional options are used. These utilities include (but are not limited to): cd, ls, pwd, find, cpio, and tar. For example, if enter:

ls -ld /usr/subdir

you see the symbolic link that references the /d1/subdir directory. To see the physical directory entry itself, with its owner, group and permission information, include the -L option:

ls -ldL /usr/subdir


See also:


Next topic: Maintaining filesystem efficiency
Previous topic: Adding disk space and restructuring filesystems

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003