Mounting Storage in FreeBSD
After upgrading the root SSD on my server from a lowly 240GB Corsair drive with no DRAM to a 500GB Samsung 870 QVO, I found myself wanting to do something interesting with the recently decomissioned corsair drive. I decided to plug it into a SATA to USB3 converter and hook it up to my FreeBSD-powered router so that I can try out ZFS (without having to install the ZFS kernel modules, which you would need on a Linux box).
Before creating a zpool, I figured I would mount the drive before any modifications. After all, I've never actually mounted a linux-formatted drive in FreeBSD before. First thing I did was to take a peak at dmesg:
ugen1.2: <SABRENT SABRENT> at usbus1 umass0 on uhub0 umass0: <SABRENT SABRENT, class 0/0, rev 3.00/2.04, addr 1> on usbus1 umass0: SCSI over Bulk-Only; quirks = 0x8100 umass0:5:0: Attached to scbus5 da0 at umass-sim0 bus 0 scbus5 target 0 lun 0 da0: <SABRENT 0204> Fixed Direct Access SPC-4 SCSI device da0: Serial Number YB4206942069G da0: 400.000MB/s transfers da0: 228936MB (468862128 512 byte sectors) da0: quirks=0x2<NO_6_BYTE>
The dmesg output explains to me that a new SCSI device (da0) is being presented to the system by way of the USB mass storage kernel module. We should now have some new device nodes in /dev:
root@router ~ $ ls /dev/da0* /dev/da0 /dev/da0s1 /dev/da0s2
Great! I see my ext4 data partition (da0s1) and a swap partition (da0s2). Now I should be able to mount my ext4 partition to a mount point:
root@router ~ $ mount /dev/da0s1 /mnt mount: /dev/da0s1: No such file or directory
This is a misleading error message, because as we can see from the above "ls /dev/da0*" command, /dev/da0s1 is a file. We're missing something... In FreeBSD, you need to specify the fstype to the mount command. But what fstype should we use for an ext4 disk?
root@router ~ $ ls /usr/src/sys/fs autofs cuse devfs fdescfs fuse nandfs nfsclient nullfs pseudofs tmpfs unionfs cd9660 deadfs ext2fs fifofs msdosfs nfs nfsserver procfs smbfs udf
FreeBSD supports ext2/3/4 through the ext2fs kernel module. If we specify the fstype, we can mount the disk:
root@router ~ $ mount -t ext2fs /dev/da0s1 /mnt root@router ~ $ ls /mnt bin dev home lib64 media opt root sbin sys usr boot etc lib lost+found mnt proc run srv tmp var
Now that I know I can mount my ext4 drive in FreeBSD, I'm going to umount it and follow along in the ZFS section of the FreeBSD handbook to create pools with "zpool" and start my journey into ZFS. I'm still not convinced that I would want to use ZFS instead of LVM, but the only way to find out is to learn more and try it for yourself. I may decide to post again with some useful ZFS information if I get a chance.