Moving Ports directory

Scot W. Hetzel hetzelsw at westbend.net
Mon Sep 22 09:03:39 PDT 2003


From: "Michael Dunham" <michaeldunham at earthlink.net>
> I'm using FreeBSD Current on an older machine.  I have two hard disks
> attached, one 3gb and one 2gb.  I have put the root on the 3gb drive but
it
> is now about 80% full.  I would like to move the Ports directory to the
2gb
> drive so I can run a new kernel build.
>
> What are the steps to move the /usr/ports directory to the other drive?
>
Is the 2Gb drive currently being used?  If not, you could dedicate the
entire drive or a partition to /usr/ports.

    mount /dev/ad1s1g /mnt
    tar -cf - -C /usr/ports . | tar xpf - -C /mnt
    rm -rf /usr/ports/*
    umount /mnt

edit /etc/fstab and add an entry for the 2GB drive

    /dev/ad1s1g             /usr/ports              ufs     rw      2
2

then mount /usr/ports

    mount /usr/ports

If you can't dedicate the entire drive or a partition, then you'll need to
do the following:

    mkdir <2GB drive mount point>/ports
    tar -cf - -C /usr/ports . | tar xpf - -C <2Gb drive mount point>/ports
    rm -rf /usr/ports
    ln <2Gb drive mount point>/ports /usr/ports

Scot



More information about the freebsd-ports mailing list