Configuring storage in FreeNAS

11244

Author: Gary Sims

The essence of the FreeNAS server is to provide storage that is easily accessible from the network. To this end, it is important to understand how FreeNAS handles hard disks and how they can be configured and used to provide the best and most reliable storage for your network.

This article is excerpted from the newly published book Learning FreeNAS from Packt Publishing.

Adding storage to the FreeNAS server is done in four steps:

  1. The FreeNAS server is “told” about a physical hard disk.
  2. This disk is formatted.
  3. The resulting storage space is mounted and made available internally.
  4. The mounted storage space is made available on the network via services like CIFS and NFS.

Step one, telling the FreeNAS server about the disks at its disposal, is handled in Disks: Management. On opening this page, you will see a list of disks that are already configured. To add a disk, click the add circle and you will be taken to the Disks: Management: Disk: Add page. Use the Disk field to select which disk you want to add to the FreeNAS configuration.

If you are using a hardware RAID controller, for the disks attached it, don’t use the standard device names for each disk. Instead, these RAID controllers present a virtual disk for each RAID set, using a device named after the RAID controller driver. For example, the amr driver (which supports controllers by MegaRAID and some Dell and Intel cards) presents its virtual disks as /dev/amrd*. Also, some RAID cards present their hard drives as /dev/da*devices.

Once you have selected the right disk from the drop down box, you can normally just go ahead and click Add. However, there are some parameters that you can tweak, and the field Preformatted FS needs to be set correctly if the disk is already formatted and has data on it. Apart from the native UFS format of the FreeBSD, FreeNAS supports FAT32, NTFS, and ext2.

Once you have selected the disk from the drop-down menu and set any of the optional parameters, you can click the Add button, then apply the changes. The Disks: Management page should now show your disk(s) in a table, including information about the disk name, size, and filesystem.

Formatting a newly added disk

Once a disk has been added to the FreeNAS server, it needs to be formatted. Go to the Disks: Format page and select which disk you wish to format. Choose the filesystem you want to use. The default will be UFS; unless you specifically need FAT32 or ext2, it is best to format the disk with UFS. UFS is the NATIVE file format for FreeBSD, the underlying OS of FreeNAS. Attempting to use other file formats can result in unpredictable results, file corruption, and loss of data.

You can also enter an optional volume label for the disk, but it isn’t very useful, as it isn’t used in the FreeNAS Web interface. Leave the minimum free space percentage at its default 8%, as lowering the threshold can adversely affect performance and auto-defragmentation. A final option allows you to tweak the way the disk is formatted, specifically to not replace the master boot record (MBR) with a new one during the format process. Normally, this shouldn’t be needed, but some hardware RAID cards store information in the MBR. If you find that the drive doesn’t format correctly and you are using a hardware RAID card, you can try formatting the disk with the option enabled.

Once you click Format Disk, you will asked if you are sure that you wish to format the disk. Click OK to proceed, then look for the Done! comment and the long list of superblock numbers before it. If you see that, everything is OK. If the formatting failed for some reason you will see an error message. For example, if spaces aren’t permitted in the volume label, trying to format a disk like this will result in the last lines of the output reading:

newfs: bad volume label. Valid characters are alphanumerics. Done!

Once you have formatted the disk, you need to mount it internally in the FreeNAS server. Go to Disks: Mount Point and click the add circle. There are several important fields to fill in here: Type, Disk, Partition, File System, and Name.

  • Type: Here, you can select if you want to mount a disk or an ISO file. For new physical disks, you need to select disk. The ISO option is useful if you have an .isofile and you wish to make its contents available on your network.
  • Disk: Select the disk which you wish to mount. This will be the same disk as you used in Disks: Management and Disks: Format.
  • Partition: Under FreeNAS, if you install the server software on a hard disk, then two partitions are created, the first for the operating system software and the second for data. When mounting disks, you need to know which partitions you wish to mount.

    By default, FreeNAS doesn’t use the legacy method to partition disks, which involved storing the partition data in the MBR; instead it used the GUID Partition Table (GPT), which is part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the soon-to-be-obsolescent PC BIOS.

    If you have just formatted this disk using FreeNAS, select EFI GPT here. If your disk has previous data on it, select which partition the data is on. If you have installed FreeNAS on a disk and you want to use the rest of the disk for data, select 2.

  • File System: For disks that have been formatted using FreeNAS, select UFS. If you have chosen to use another filesystem format or the disk already had data on it, select the appropriate file system type (FAT, NTFS, or ext2).
  • Name: Each mounted disk needs a name to distinguish it from other disks. It does seem possible to use spaces in the name but for safety I recommend using a simple single-word mount point name. The name specified will be used to mount the disk under the /mnt directory on the FreeNAS server, so if, for example, we used store2, then the disk will be mounted on /mnt/store2 and that would be the name used to share the disk on the network using CIFS.
  • Description: You can fill in an optional description for this mount point.
  • Read only: Tick this to mount the file system as read-only, and even the Administrator account (superuser/root) may not write it.

Once you have filled in all the data, click the Add button. You will be shown a table with a list of the mounted drives on the FreeNAS server. Their status will be listed as Configuring. Click Apply changes. Once the changes have been applied, the newly displayed table should include the new mount point with the status of OK.

Category:

  • Storage