Link to home
Start Free TrialLog in
Avatar of hrolsons
hrolsonsFlag for United States of America

asked on

Mount new hard drive in FreeBSD

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?
ASKER CERTIFIED SOLUTION
Avatar of Keith Brown
Keith Brown
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skullnobrains
skullnobrains

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

USING UFS WITHOUT PARTITIONNING THE DRIVE
#> 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.

USING UFS WITH A REGULAR BSD PARTITION SCHEME
* 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)

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

EXISTING DISKS
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"
Avatar of hrolsons

ASKER

User generated image
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
It seems the disk is not formatted and when I run fdisk it doesn't like the geometry settings of the new disk.
"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...
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.
"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.