Skip to content

BubaVV/thumbdrive

Repository files navigation

Trek ThumbDrive — Linux Userspace Driver

A userspace driver and NBD server for the Trek ThumbDrive (VID 0x0a16, PID 0x1111), a pre-USB-mass-storage flash drive from 1999–2000. The device uses a vendor-specific USB protocol that no modern OS supports natively. This project lets you read and write it on Linux via an NBD (Network Block Device) mount.

Capacity: 32 MB (65 536 sectors × 512 bytes)

Prerequisites (Debian / Ubuntu)

sudo apt install python3 python3-usb nbd-client

nbd-client pulls in the nbd kernel module. If you prefer a virtualenv, install pyusb from requirements.txt instead of the system python3-usb package.

Installation

# Clone the repo
git clone https://github.com/BubaVV/thumbdrive.git
sudo cp -r thumbdrive /opt/trek-thumbdrive

# Install the udev rule (grants non-root USB access, triggers systemd on plug)
sudo cp /opt/trek-thumbdrive/udev/50-trek.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

# Install systemd services
sudo cp /opt/trek-thumbdrive/systemd/trek-nbd-server.service /etc/systemd/system/
sudo cp /opt/trek-thumbdrive/systemd/trek-nbd-mount.service  /etc/systemd/system/
sudo systemctl daemon-reload

Re-plug the device after installing the udev rule.

Automated usage (plug-and-mount)

With the udev rule and systemd services installed, plugging in the Trek ThumbDrive will automatically:

  1. Start the NBD server (trek-nbd-server.service)
  2. Connect nbd-client, mount /dev/nbd0 at /mnt/trek (trek-nbd-mount.service)

Check status:

systemctl status trek-nbd-server
systemctl status trek-nbd-mount

To stop and unmount:

sudo systemctl stop trek-nbd-mount

Manual usage

NBD server + mount

# Start the server (binds to 127.0.0.1:10809 by default)
sudo python3 nbd_server.py --trek

# In another terminal — connect and mount
sudo modprobe nbd
sudo nbd-client 127.0.0.1 10809 /dev/nbd0
sudo mkdir -p /mnt/trek
sudo mount /dev/nbd0 /mnt/trek

# Access files
ls /mnt/trek/

# Clean up
sudo umount /mnt/trek
sudo nbd-client -d /dev/nbd0

Server flags:

Flag Description
--trek Use the physical Trek ThumbDrive
--file PATH Use a raw disk image (for testing without hardware)
--host ADDR Bind address (default 127.0.0.1; use 0.0.0.0 for remote access)
--port PORT TCP port (default 10809)
--ro Export as read-only

Direct USB utility

trek_usb.py provides a CLI for low-level operations without NBD:

# Print device info and capacity
sudo python3 trek_usb.py info

# Read sectors to stdout
sudo python3 trek_usb.py read 0 4

# Read sectors to a file
sudo python3 trek_usb.py read 0 4 -o first_sectors.bin

# Dump entire device to a raw image
sudo python3 trek_usb.py dump disk.img

Protocol documentation

See PROTOCOL.md for the reverse-engineered Trek USB protocol specification (control transfers, command format, capacity query).

Project layout

trek_usb.py          — USB driver library (UsbTransport → TrekDevice → BlockDevice)
nbd_server.py        — NBD server frontend
requirements.txt     — Python dependencies (pyusb)
udev/                — udev rule for USB permissions + systemd trigger
systemd/             — systemd service units (server + mount)
win_driver/          — Original Windows XP/2000 driver (reference only)
dumps/               — USB packet captures used during reverse engineering
PROTOCOL.md          — Trek USB protocol specification
PROTOCOL_ANALYSIS.md — USB capture analysis notes

License

This project is provided as-is for historical preservation and hobbyist use.

About

Some attempts to connect antique Trek Thumdrive USB flash to Linux box

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages