The times are not so long ago, when everybody always had an USB stick in his pocket. After the era of optical storage media, USB sticks were for a few years the medium of choice. Today, physical storage mediums were relieved by the cloud so nearly nobody needs to cary a stick with him anymore.
But what to do with all the old sticks, lying somewhere between cables and other useless IT stuff in a box below your desk? If you also have some old USB hubs and a Raspberry Pi, you can reuse them as a big mass storage medium…
Lets plug everything together. In the picture above, I plugged 8 USB sticks into two USB hubs and connected them to a Raspberry Pi 4 with 4 GB RAM. The system sees them as:
/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf1 /dev/sdg1 /dev/sdh1
The devices and partition layout can be different in another setting. Lets create a logical volume via the Logical Volume Manager (LVM) out of them.
Be careful: All data on the sticks will be erased! Make sure not to choose the wrong device in the following commands!
Lets initialize the USB sticks:
pvcreate /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf1 /dev/sdg1 /dev/sdh1
Now, create a LVM group out of the physical sticks:
vgcreate GROUP /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf1 /dev/sdg1 /dev/sdh1
In this group, create a volume with a given size, here 64 GB:
lvcreate -L 64G -n VOL GROUP
Last step, create a filesystem on the volume and mount it to a directory (here “/mnt/vol”):
mkfs.ext4 /dev/GROUP/VOL mkdir /mnt/vol mount /dev/GROUP/VOL /mnt/vol/
You can see now a big volume of nearly 64 GB, mounted on /mnt/vol:
df -h ... /dev/mapper/GROUP-VOL 62G 53M 59G 1% /mnt/vol ...
Don’t expect good performance or reliability. Copying a 5 GB folder needed 20 minutes. But in general it works.