# Mounting a harddrive



## Roberth (Jan 20, 2009)

Hello

I am very new to this OS, I have past experience with Linux in general. I have installed FreeBSD on my main computer, the computer has two harddrives, /dev/ad6 my os disk, with has FreeBSD installed, then I have a DATA disk, which is an SATA harddrive, with ext3 filesystem. 

I guess that the DATA disk is /dev/ad8, but it has several slices, can this be the correct harddrive? If it's not which one is it and how do I mount it?


----------



## Djn (Jan 20, 2009)

Why capital letters in data?

Anyway. If there is a /dev/ad8, then that's another drive - probably the right one. If you do _fdisk ad8_ it'll tell you what the different partitions are.

What to do from there on depends on how it's set up - could you show the output of that fdisk command, and perhaps _file -s /dev/ad8*_ ?


----------



## Roberth (Jan 20, 2009)

Well because I call it "DATA".

[root@magda /]# file -s /dev/ad8*
/dev/ad8:   x86 boot sector; partition 2: ID=0x5, active, starthead 0, startsector 16065, 1953504000 sectors
/dev/ad8s2: x86 boot sector; partition 1: ID=0x83, starthead 1, startsector 63, 1953503937 sectors
/dev/ad8s5: Linux rev 1.0 ext3 filesystem data (errors) (large files)


----------



## Djn (Jan 20, 2009)

Fair enough. 

Anyway - you've got one primary and one logical partition (s1-4 are reserved for primary partitions, then s5 is the first logical one). I'd guess s2 is the extended "container" partition, since it overlaps s5.

Since ad8s5 is also the only one with a sensible filesystem, that's the one you want. 
It's apparently marked as having errors, so you might need to install sysutils/e2fstools and run _e2fsck -p /dev/ad8s5_ before you can mount it.
With that done, you can try to _mount -t ext2fs /dev/ad8s5 /mnt_ and see if that works.

There's also an ongoing issue you might run into where you get a "bad file descriptor"-error if you try to do anything on the mounted volume. This is fixed in the newest current and will be in 7.2, but in the meantime you'll have to read this if it happens.

If everything works, you should be able to add  

```
/dev/ad8s5    /data    ext2fs    rw    2 2
```
to /etc/fstab and have it mounted on boot. Just remember to mkdir /data (or whatever directory you prefer).


----------



## Roberth (Jan 20, 2009)

[root@magda /home/roberth]# mount -t ext2fs /dev/ad8s5 /media/DATA
mount: /dev/ad8s5 : Operation not permitted

Uhm, root don't have permission?


----------



## Djn (Jan 20, 2009)

Oh, by the way: This will treat it as an ext2 volume, so linux won't be entirely happy and probably run a fsck next time it sees it. It's not harmful, but perhaps a bit annoying.


----------



## Djn (Jan 20, 2009)

Does that directory exist, and did you run the fsck first?
This can also happen if it's already mounted, but I somehow doubt that. Still, check the output of _mount_ to make sure, if nothing else seems to be wrong.

(Sorry about the double post - accident, and I can't find a way to delete this post to merge them.)


----------



## Roberth (Jan 20, 2009)

How do I define filesystem type when running fsck?


----------



## Djn (Jan 20, 2009)

Either _-t ext2fs_, or you can use one of the several aliases for the dedicated binary (e2fsck / fsck.ext2 / fsck_ext2fs).


----------



## Roberth (Jan 20, 2009)

Well when I use fsck -t ext2fs it looks for fsck_ext2fs which it can't find...


----------



## Djn (Jan 20, 2009)

As mentioned, you need to install e2fsprogs.
If you've got a ports tree:

```
cd /usr/ports/sysutils/e2fsprogs
make install clean
rehash
```

If not, try _pkg_add -r e2fsprogs_ .


----------



## Roberth (Jan 20, 2009)

Oh, sorry didn't read the posts carefully enough...


----------

