Mount new hard drive in FreeBSD

Posted on 2011-10-20
Last Modified: 2016-02-10
I do not know very much Linux, so please be gentle.

I needed more room so I had my hosting company attach a new secondary hard drive.  I would like to mount it so that the directory "/usr/local/www/vhosts/host1" is the new hard drive.

Can someone help walk me through that?
Question by:hrolsons
    LVL 7

    Accepted Solution

    Has the drive been formatted yet? If not, then you'll need to do so first.

    If it has been formatted (I am assuming it is), then you'll need to do the following as root.
    mount /dev/DRIVE /usr/local/www/vhosts/host1

    The DRIVE portion is the file in /dev/ associated with the drive. Under linux systems, it'd likely be hdb1 or sdb1. The hd is for hard disk, sd is for serial disk (used often for scsi or sata systems), the third letter denotes which physical drive it is, with "a" being assigned to the first drive in the system (where your install of FreeBSD most likely is), and since this is an additional drive, it mostlikely is "b". The number at the end points out which partition you want it to use on the drive. Most likely it is the only partition on the drive, so we start with 1. Sometimes, under FreeBSD, IDE based drives will start with a, for ATA. I'd try mounting /dev/hdb1, /dev/sdb1, and /dev/adb1 first.

    Now, if you just use the mount command, you'll need to remount if the system gets started. I'm not as familiar with FreeBSD, but under Linux (and likely the same for you), there is a file called /etc/fstab that tracks which drives to mount automatically at boot. Using the other ones as reference, it is easy to add another line to auto mount the new drive.

    I'm more of a penguin user, but hopefully this will help, and if I can, I'll pop back in with more info later.
    LVL 25

    Expert Comment

    using ZFS
    #> zpool add -o mountpoint=/usr/local/www/vhosts/host1 /dev/daX where X is the drive number
    you can just do "ls /dev/da*" to find out the drive number

    #> newfs /dev/daX (create the filesystem)
    #> mount /dev/daX /usr/local/www/vhosts/host1 (mount the filesystem)
    you probably want to add a line to fstab as well so it gets mounted when you boot.
    just copy and paste the existing line for /usr or /var and adapt the mountpoint and device name.

    * use "fdisk -i" or a graphic tool to create slices on the drive (usually abusively called partitions by linux and windows users)
    * use "bsdlabel -i" to partition de drive
    * reboot so /dev gets updated
    * then follow the same steps as above but add the slice and partition to the device name
    for example /dev/da2s1a is the disk number 2 (da2), first slice (s1), and first partition (a)

    add "-t msdosfs" to the mount command if for example your disk is fat32

    if the disk was already used, it should contain clices but no partitions
    the windows C drive should be the first slice
    your mount command will look like "mount -t msdosfs /dev/da2s1 /path/to/mountpoint"

    Author Comment

    ls /dev
    LVL 25

    Expert Comment

    ad5 and ad6 are hard drives (probably IDE drives)
    they change name depending on the driver. i assumed da and not ad as most modern drives use the da driver

    ad6 contains one slice and partitions
    a is probably your root ("/") partition
    b is always reserved for swap
    c is a fake partition that is mapped to the slice as far as i can remember

    i guess your current installation is on ad6
    you can confirm this using the "mount" command without arguments

    if ad6 is actually your system drive and ad5 is not mounted anywhere,
    ad5 should be your new drive and you can go on using the information i provided previously

    good luck

    Author Comment

    It seems the disk is not formatted and when I run fdisk it doesn't like the geometry settings of the new disk.
    LVL 25

    Expert Comment

    "it seems..."
    "it does not like..."

    what do you type ?
    what output do you get ?
    have you tried to format the disk ?
    have you tried any of the possibilities i gave you ? which one ? what result ?

    can't help you if you neither help yourself or give enough information for us to help...

    Author Comment

    I had the hosting company format and mount it, not sure how to award points.  I had the hosting company do it after I got locked out of my own server by having something wrong in /etc/fstab.
    LVL 61

    Expert Comment

    "I do not know very much Linux, so please be gentle."

    First of all FreeBSD is not Linux , and not even related from their origins.

    In FreeBSD most system maintenance tasks are done using sysinstall command (/stand/sysinstall in old versions)

    It will rescan scsi bus, read partition tables, make them anew and make everybody happy.

    v5-v6.0 had broke fdisk which did not work well with GEOM, so sysinstall was the only viable option.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now