This page looks best with JavaScript enabled

Concatenation of disks in FreeBSD with GEOM

 ·  🎃 kr0m

In FreeBSD, several file systems can be used, but the most commonly used are ZFS and UFS. The latter can be interesting in scenarios where advanced features are not required and there is not much RAM available. In this case, it is a download server with 16 GB of RAM.

One of the advantages of using ZFS is that the disk/volume/FS manager is integrated into a single unified tool, while in UFS we will have to combine several tools. For example, to concatenate several disks, we must use GEOM and UFS as the file system.

We check the available disks in the system:

camcontrol devlist

<WDC WDS500G1B0A-00H9H0 X41100WD>  at scbus0 target 0 lun 0 (pass0,ada0)
<Samsung SSD 850 EVO 500GB EMT02B6Q>  at scbus1 target 0 lun 0 (pass1,ada1)
<TOSHIBA MD04ACA400 FP2A>          at scbus2 target 0 lun 0 (pass2,ada2)
<ST8000AS0002-1NA17Z AR13>         at scbus3 target 0 lun 0 (pass3,ada3)
<AHCI SGPIO Enclosure 2.00 0001>   at scbus6 target 0 lun 0 (pass4,ses0)
<HP iLO LUN 00 Media 0 2.09>       at scbus7 target 0 lun 0 (da0,pass5)

We are going to use ada2 and ada3, so we erase the disks for a long time (I left it for 1 hour) to ensure that there is no previous configuration of any file system or partition scheme:

dd if=/dev/zero of=/dev/ada2 bs=10m
dd if=/dev/zero of=/dev/ada3 bs=10m

It should be noted that GEOM also supports “Stripe,” but this is a raid0, which means distributing the data equally among the disks. Therefore, all disks must be the same size. I mention this because it can be misleading.

In my case, I am going to use “Concat” . We load the module:

kldload geom_concat
echo 'geom_concat_load="YES"' >> /boot/loader.conf

We create the concat device with the label torrents:

gconcat label -v torrents /dev/ada2 /dev/ada3

We can check the status. As we can see, it has joined the 4T disk with the 8T disk, forming an 11T disk:

gconcat list

Geom name: torrents
State: UP
Status: Total=2, Online=2
Type: AUTOMATIC
ID: 2044152479
Providers:
1. Name: concat/torrents
   Mediasize: 12002350251008 (11T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
Consumers:
1. Name: ada2
   Mediasize: 4000787030016 (3.6T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   Start: 0
   End: 4000787029504
2. Name: ada3
   Mediasize: 8001563222016 (7.3T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   Start: 4000787029504
   End: 12002350251008

We create the file system on the new device:

newfs /dev/concat/torrents

We assemble the device:

mkdir /mnt/torrents
mount /dev/concat/torrents /mnt/torrents

We create the associated entry in fstab:

echo “/dev/concat/torrents /mnt/torrents ufs rw 2 2” » /etc/fstab

We check that everything is in order:

df -Th /mnt/torrents/

Filesystem            Type    Size    Used   Avail Capacity  Mounted on
/dev/concat/torrents  ufs      11T    1,0K     11T     0%    /mnt/torrents
If you liked the article, you can treat me to a RedBull here