A brief Recap

I set up a torrent seedbox on my desk and that worked great! The first post is here in case you missed it.

I paired it with a 500gb 2.5" drive I had lying around and its seeding away 24/7 at 15-30Mb/s. But that only gave me 750gb of storage to work with and that isn’t enough for my enterprising file sharing goals.

Sure it was good enough for a start:

But two things happened:

  • I ran out of space
  • The I/O usage was pegged at 100%, probably due to too much random I/O access from dozens of torrents

More storage was needed, and if I could get it fast and cheap, then better!

Getting more storage

In the spirit of keeping this a budget project, I went looking for cheap storage on eBay, and I found some Seagate Terascale 4TB drives for 49€ each. I offered 47€ a piece for two drives, the seller accepted, and a few days later here they were:

The date codes are from early 2014, these certainly came from a datacenter somewhere. Neat.

These don’t fit anywhere on the mini pc I’m using for seedboxing:

Which means we’re going to do this over USB:

But I’m not going to leave the drives out and about on my desk, that’s no good. No no I have a much “better” idea.

I have this small plastic drawer set I can use to house the drives. But how are the cables from the drives going to exit the drawers? Glad you asked, let me get something from under my bed:

That's right, we're gonna Dremel our way to success.

Uuuh there was a bit of a happy accident with the middle drawer.

Overall, not bad!

Lets assemble everything, plug in the disks, turn the computer on and… oh.

Disk errors make pepe sad.

Something didn’t work – I might’ve pushed my luck a bit too far with eBay disks and Aliexpress adaptors.

After some brief troubleshooting, I narrowed it down to one of the USB adaptors being faulty. Luckily I had spare one from Amazon that is known to work. I’m now using different adaptors for each disk, I hereby knock on wood.

RAID 0 over USB

The kernel wiki tells me RAID over USB is a bad idea, but I want read access to be fast. Bad ideas can be entertaining, I’m going to use this tutorial from Linuxbabe.com as a starting point.

Here’s everything executed to set up RAID:

sudo su
parted /dev/sdb mklabel gpt
parted /dev/sdc mklabel gpt
fdisk /dev/sdb <- n, enter, enter, enter, t, raid, enter, w 
fdisk /dev/sdc <- n, enter, enter, enter, t, raid, enter, w 
apt-get update
apt-get install mdadm
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
mkfs.ext4 /dev/md0
mount /dev/md0 /disk

The above worked, lets write something to disk and see what gives:

mkdir -p /disk/benchmark
cd disk/benchmark
dd if=/dev/zero of=data.bin bs=1M count=10000

Aaaand its taking forever. Something doesn’t feel right. I’m gonna go get some toast or something and check this in a few minutes.

I’m back with a yoghurt and dear god:

[ 4908.422277] blk_update_request: I/O error, dev sdb, sector 17599488 op 0x1:(WRITE) flags 0x0 phys_seg 128 prio class 0
[ 4908.422398] EXT4-fs warning (device md0): ext4_end_bio:344: I/O error 10 writing to inode 172097562 starting block 4333440)
[ 4908.422421] sd 6:0:0:0: [sdb] tag#27 timing out command, waited 180s
[ 4908.422489] Buffer I/O error on device md0, logical block 4331520
[ 4908.422496] sd 6:0:0:0: [sdb] tag#27 FAILED Result: hostbyte=DID_RESET driverbyte=DRIVER_OK cmd_age=184s
[ 4908.422501] sd 6:0:0:0: [sdb] tag#27 CDB: Write(16) 8a 00 00 00 00 00 01 0c 98 00 00 00 04 00 00 00
[ 4908.422575] blk_update_request: I/O error, dev sdb, sector 17602560 op 0x1:(WRITE) flags 0x0 phys_seg 128 prio class 0
[ 4908.422582] Buffer I/O error on device md0, logical block 4331521
[ 4908.422774] Buffer I/O error on device md0, logical block 4331522
[ 4908.422846] Buffer I/O error on device md0, logical block 4331523
[ 4908.422917] Buffer I/O error on device md0, logical block 4331524

But wait there’s more:

Message from syslogd@fujitsu at Feb 25 19:17:44 ...
 kernel:[ 5314.790940] EXT4-fs (md0): failed to convert unwritten extents to written extents -- potential data loss!  (inode 172097562, error -30)

Yeah this not going well at all 😂

I’m looking at the output of dstat and a few hundred megabytes are written to disk and then nothing is written for several seconds. I wonder if the kernel cannot handle disk caching on raid over USB correctly. Let me try disabling disk cache to see if that’ll do anything:

root@fujitsu:/home/daniel# hdparm -W 0 /dev/md0
/dev/md0:
 setting drive write-caching to 0 (off)
 HDIO_DRIVE_CMD(flushcache) failed: Inappropriate ioctl for device
 HDIO_DRIVE_CMD(setcache) failed: Inappropriate ioctl for device
 HDIO_DRIVE_CMD(flushcache) failed: Inappropriate ioctl for device

This is odd. I was expecting maybe a hiccup or two with RAID over USB but this is too catastrophic, some more troubleshooting is in order.

Oh noes

The other Aliexpress SATA to USB adaptor was also faulty. Out of the two adaptors:

  • One was completely faulty (disk wouldn’t even show)
  • One was partially faulty (disk would show but writes would fail).

Into the trash they go, Aliexpress can be a gamble and this time we didn’t win.

RAID 0 over USB could still work, but with these cursed adaptors its not something we’ll find out today. So back to the drawing board – what can be accomplished with the hardware we have at hand right now?

Here’s what we have on the humble plastic drawer set:

Level Item Details
3 Fujitsu One square chonky boi
2 2.5" 1TB, 500GB Disks with other SATA to USB adaptors I had lying around (no PSUs, so not for 3.5")
1 3.5" 4TB Connected with a working SATA to USB adaptor from Amazon
0 3.5" 4TB Unused until I get another adaptor or do something else with it

This leaves this set up with 5.5TB of storage over 3 disks. Not what I was aiming for, but it’ll do until I revisit this project again.

Upgrading transmission

On the first post, I noticed that the transmission-daemon had a memory leak with my use case:

I googled a bit and people with this issue were told to upgrade. Ubuntu only has the 3.0 version on the apt repos, lets try the 4.0 version from transmissionbt.com/download:

wget https://github.com/transmission/transmission/releases/download/4.0.1/transmission-4.0.1.tar.xz
tar -xvlf https://github.com/transmission/transmission/releases/download/4.0.1/transmission-4.0.1.tar.xz
cd transmission-4.0.1/
vim docs/Building-Transmission.md #Ah, instructions!
apt-get install git build-essential cmake libcurl4-openssl-dev libssl-dev python3 build-essential automake autoconf libtool pkg-config intltool libcurl4-openssl-dev libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make
sudo make install

And tranmission is upgraded!

A conclusion, for now

Things didn’t go as planned but this was an entertaining experience and I learned a thing or two. I’ll almost certainly revisit this project again in the future, so there’ll be more shenanigans to come. Until next time!

An update, a few months later

Shortly after this whole adaptor fiasco I got myself some better SATA to USB adaptors (25€ ugreen ones on Amazon) and set up the RAID 0 over USB as intended with no issues. It has been working great these last few months:

df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  1.7M  1.6G   1% /run
/dev/sda6       170G   20G  142G  12% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sdb1       458G  190G  245G  44% /disk3
/dev/sdd1       916G   36K  870G   1% /disk2
/dev/md0        7.3T  840G  6.1T  12% /disk

Only once the BIOS got a bit confused once after a power outtage and didn’t detect a disc right away. Some USB unplugging, plugging and restarts fixed it. I had no Linux or Kernel level issues.

RAID over USB is definitely not suited for storing data reliably, but for a homelab project or for data that can be easily recreated (such torrents) it does work reliably enough. Thank you for reading!