Mapping Drives in Linux (Blobber folders)

By default, the blobber repo maps blobber paths to a fixed path it creates within the repo itself. Note, some of the commands shown in here may need to be performed as root or prefixed with sudo

e.g.
~/blobber/docker.local/blobber1

If you are thinking that surely that is part of the operating system hard disk, then you are right. What we need here is to set a mount point to our physical hard disk at this location.

Now this stage cannot easily be automated because each configuration is different. But if you have followed the recommended specs, you might have something resembling the following;

lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda           8:0    1   7.3T  0 disk  
└─sda1        8:1    1   7.3T  0 part  /blobber3
sdb           8:16   1   7.3T  0 disk  
└─sdb1        8:17   1   7.3T  0 part  /blobber1
sdc           8:32   1   7.3T  0 disk  
└─sdc1        8:33   1   7.3T  0 part  /blobber2
nvme1n1     259:0    0  1.8T  0 disk  
├─nvme1n1p1 259:2    0    4G  0 part  
│ └─md0       9:0    0    4G  0 raid1 [SWAP]
├─nvme1n1p2 259:3    0  512M  0 part  
│ └─md1       9:1    0  511M  0 raid1 /boot
└─nvme1n1p3 259:4    0  1.8T  0 part  
  └─md2       9:2    0  1.8T  0 raid1 /
nvme0n1     259:1    0  1.8T  0 disk  
├─nvme0n1p1 259:5    0    4G  0 part  
│ └─md0       9:0    0    4G  0 raid1 [SWAP]
├─nvme0n1p2 259:6    0  512M  0 part  
│ └─md1       9:1    0  511M  0 raid1 /boot
└─nvme0n1p3 259:7    0  1.8T  0 part  
  └─md2       9:2    0  1.8T  0 raid1 /

On this server, the Operating system is on a raid pair on the nvme disks. We are interested in the sdX blobber disks section

sda           8:0    1   7.3T  0 disk  
└─sda1        8:1    1   7.3T  0 part  /blobber3
sdb           8:16   1   7.3T  0 disk  
└─sdb1        8:17   1   7.3T  0 part  /blobber1
sdc           8:32   1   7.3T  0 disk  
└─sdc1        8:33   1   7.3T  0 part  /blobber2

Depending on how your OS was installed, you may not have partitions already created in these disks like:-

sda           8:0    0 14.6T  0 disk
sdb           8:16   0 14.6T  0 disk

For these, we will need to create partitions first before we can mount them to the docker blobber mount paths.

Creating partitions in the drives

You may have parted already installed, if not, install with

sudo apt install parted

So for each of the /dev/sdX devices listed above, if they only show disk and no part section, they will need to have partitions created;

parted /dev/sda mklabel gpt yes
parted /dev/sda mkpart primary 0% 100% yes

So now if we lsblk we should see:-

sda           8:0    0 14.6T  0 disk  
└─sda1        8:1    0 14.6T  0 part  
sdb           8:16   0 14.6T  0 disk

So lets create a partition for sdb;

parted /dev/sdb mklabel gpt yes
parted /dev/sdb mkpart primary 0% 100% yes
sda           8:0    0 14.6T  0 disk  
└─sda1        8:1    0 14.6T  0 part  
sdb           8:16   0 14.6T  0 disk  
└─sdb1        8:17   0 14.6T  0 part

Cool, now lets make sure they are formatted to ext4 which is a modern Linux format, note that we are referencing the partition created within the disk now which has a 1 after the disk
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sdb1

These should now be ready to mount.

Mounting HDDs to default blobber paths

For ease of reference, we will map the partitions for each /dev/sdX disk in ascending order with blobbers, but there is no need for this. If anything changes in future, like a disk is added or swapped out, the mappings could change.

(You should only perform this after the docker repo has been cloned. If you do it beforehand, you will have problems trying to git clone into the existing blobber folder)
The ./docker.local/bin/blobber.init.setup.sh command creates the initial blobber folder structure. If this has not been performed yet, then you can create them manually (adjust the path in case your folder structure is different.

mkdir ~/blobber/docker.local/blobber1
mkdir ~/blobber/docker.local/blobber2
mkdir ~/blobber/docker.local/blobber3

Then for each blobber, we will mount the HDD to the desired path. (If you have existing mounts, you will want to check the contents of those paths to make sure you don’t have any data loss);

mount /dev/sda1 ~/blobber/docker.local/blobber1
mount /dev/sdb1 ~/blobber/docker.local/blobber2
mount /dev/sdc1 ~/blobber/docker.local/blobber3

Check all looks okay:-

lsblk
sda           8:0    0 14.6T  0 disk  
└─sda1        8:1    0 14.6T  0 part  /root/blobber/docker.local/blobber1
sdb           8:16   0 14.6T  0 disk  
└─sdb1        8:17   0 14.6T  0 part  /root/blobber/docker.local/blobber2

Now you can (re)run the blobber init script from within the ~/blobber folder ./docker.local/bin/blobber.init.setup.sh

When mounting it will warn you to also edit /etc/fstab. I’m not sure this is necessary to do manually, I think it gets done on the next reboot so I wont complicate this any further with that.