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).
- 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
- 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.'
- Boot to single user mode:
disk1a> boot -s
# fsck -p
# mount -u /
# mount -a -t ufs
# swapon -a - Run sysinstall:
# /stand/sysinstall
- Choose 'Configure,' then 'Fdisk' from the menu, then choose drive 'wd1.'
- 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.
- Choose 'Label' from the menu.
- 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.
- Exit sysinstall.
- Choose 'Configure,' then 'Fdisk' from the menu, then choose drive 'wd1.'
- 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.
- Delete the symlink to /usr/var and create a new mount point:
# rm /var
# mkdir /var
- Make sure the device special file /dev/wd1s1e exists, or run MAKEDEV:
# cd /dev
# ./MAKEDEV all - Test the new filesystem by mounting it manually:
# mount /dev/wd1s1e /var
- If softupdates are compiled into the kernel, enable soft updates on the new filesystem:
- Reboot to single-user mode:
# shutdown now
- Enable softupdates:
# tunefs -n enable /dev/rwd1s1e
- Mount the remaining filesystems:
# mount -u /
# mount -a -t ufs
# swapon -a
- Reboot to single-user mode:
- 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
- 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