Installing a Second Hard Drive For Use as /var Filesystem

Applicable to: FreeBSD 3.x

Updated: November 7, 1999

Warning! This procedure has not been verified to work correctly with versions of FreeBSD later than 3.4. If you encounter problems, please e-mail me with suggested corrections.

This Sheet describes the procedure I used to install a second hard drive. The original 1.2GB drive was getting cramped, so I decided to add a second drive (as /var) to free-up space on the /usr filesystem (/var was a symlink to /usr/var).


  1. Rebuild the kernel with support for an additional drive (in this case, as the slave drive on the primary IDE controller):

    controller  wdc0  at isa? port "IO_WD1" bio irq 14 flags 0xa0ffa0ff

    disk        wd0   at wdc0 drive 0

    disk        wd1   at wdc0 drive 1


  2. Shutdown and install the additional drive as the slave on the primary IDE controller. Be sure to set the existing drive from 'single' to 'master.'

  3. Boot to single user mode:

    disk1a> boot -s

    # fsck -p

    # mount -u /

    # mount -a -t ufs

    # swapon -a

  4. Run sysinstall:

    # /stand/sysinstall


    1. Choose 'Configure,' then 'Fdisk' from the menu, then choose drive 'wd1.'

    2. In the FDISK Partition Editor, choose 'A' to use the entire disk. At the warning, choose 'NO' to accept dangerously dedicated disk. Press 'Q' to continue.

    3. Choose 'Label' from the menu.

    4. In the Disklabel Editor, create the following partitions:

      wd1s1b  swap   128MB as swap

      wd1s1e  /var   remaining as UFS


      Choose 'W' to write changes to disk, then choose 'Q' to continue.

    5. Exit sysinstall.

  5. Edit /etc/fstab to include the new filesystems:


    # Device     Mountpoint  FStype  Options  Dump  Pass#

    /dev/wd1s1b  none        swap    sw       0     0

    /dev/wd1s1e  /var        ufs     rw       2     2

    Set the 'Pass#' as shown, or fsck will not automatically preen the filesystem on startup.

  6. Delete the symlink to /usr/var and create a new mount point:

    # rm /var

    # mkdir /var


  7. Make sure the device special file /dev/wd1s1e exists, or run MAKEDEV:

    # cd /dev

    # ./MAKEDEV all

  8. Test the new filesystem by mounting it manually:

    # mount /dev/wd1s1e /var


  9. If softupdates are compiled into the kernel, enable soft updates on the new filesystem:

    1. Reboot to single-user mode:

      # shutdown now

    2. Enable softupdates:

      # tunefs -n enable /dev/rwd1s1e

    3. Mount the remaining filesystems:

      # mount -u /

      # mount -a -t ufs

      # swapon -a


  10. Move /usr/var to /var:

    # cd /usr/var

    # tar cf - . | (cd /var; tar xf - )

    # ls -al /var  (Check that files were properly copied)

    # rm -rf /usr/var


  11. Reboot and observe startup messages to ensure the system is functioning properly.






http://www.mostgraveconcern.com/freebsd/


Questions or Comments? Contact Us...





Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.