Adding Storage to External Enclosure on Arch

Plugged in, didn’t see anything. Checked with

lsblk
lsusb -t
sudo dmesg

When running lsusb -t, you could see at the bottom:

/: Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M 
|__ Port 001: Dev 026, If 0, Class=Hub, Driver=hub/4p, 5000M 
|__ Port 002: Dev 027, If 0, Class=Hub, Driver=hub/4p, 5000M 
|__ Port 003: Dev 031, If 0, Class=Mass Storage, Driver=[none], 5000M

Class=Mass Storage, Driver=[none] is the part in question here.

The solution, is rather simple it seems

sudo pacman -Syu linux linux-headers
sudo reboot

Now, when running lsblk,

sdb           8:16   0   1.8T  0 disk 

That’s the one.

And now, when I run lsusb -t, i see:

/:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/4p, 5000M
    |__ Port 002: Dev 003, If 0, Class=Hub, Driver=hub/4p, 5000M
    |__ Port 003: Dev 004, If 0, Class=Mass Storage, Driver=uas, 5000M

The driver is added there: Driver=uas


So now that we got the drive being recognized, we need to format it.

We are going to go with exFAT because we want this to be cross compatible.

Install needed packages

sudo pacman -S --needed exfatprogs gdisk

Find the disk-id

ls -lrath /dev/disk/by-id
EXT=/dev/disk/by-id/usb-CT2000T5_00SSD8_0129380009AB-0:0
# 
sudo wipefs -a "$EXT"

sgdisk:

  • CLI GPT partitioner (from gdisk).
  • Edits GUID Partition Table directly (not MBR).
  • Flags:
    • –zap-all – wipe GPT headers + partition entries (and PMBR).
    • -n 1:1MiB:0 – create partition #1 from 1 MiB to end of disk.
    • -t 1:0700 – set partition #1 type GUID to Microsoft Basic Data (for exFAT/NTFS).
    • -c 1:‘data’ – set partition #1 label.
sudo sgdisk --zap-all "$EXT"
sudo sgdisk -n 1:1MiB:0 -t 1:0700 -c 1:'data' "$EXT"

Instead of sgdisk, you could also use fdisk or parted.

partprobe:

  • Tells the kernel to re-read the partition table
  • Triggers udev events
  • Not needed if you’re formatting the whole disk (no partitions), but needed right after (re)partitioning so the new nodes show up.
sudo partprobe "$EXT"
PART="${EXT}-part1"
sudo mkfs.exfat -n DATA "$PART"

I did not need to do anything after that for the disk to be up and running, and ready for use.

sudo mkdir -p /mnt/data
sudo mount -t exfat -o uid=$(id -u),gid=$(id -g),umask=022,windows_names,flush "$PART" /mnt/data
df -Th /mnt/data
UUID=$(blkid -s UUID -o value "$PART")
echo "UUID=$UUID  /mnt/data  exfat  uid=$(id -u),gid=$(id -g),umask=022,windows_names,flush  0  0" | sudo tee -a /etc/fstab

Or, with fdisk:

# 0) Pick the right disk (use by-id to avoid mixups)
ls -l /dev/disk/by-id | grep -i usb
DISK=/dev/disk/by-id/usb-<your-rtl9210>   # or /dev/sdb

# 1) Wipe old sigs (safe on a new disk but still good hygiene)
sudo wipefs -a "$DISK"

# 2) fdisk: GPT + single partition (accept defaults)
sudo fdisk "$DISK" <<'EOF'
g
n


+100%
p
w
EOF

# 3) Make ext4
PART="${DISK}-part1"                       # if you used by-id
# PART="/dev/sdb1"                         # if you used /dev/sdX
sudo mkfs.ext4 -L data "$PART"

# 4) Mount now
sudo mkdir -p /mnt/data
sudo mount "$PART" /mnt/data
df -h /mnt/data

# 5) Persist via fstab (UUID is safer than /dev/sdX)
UUID=$(blkid -s UUID -o value "$PART")
echo "UUID=$UUID /mnt/data ext4 noatime,defaults 0 2" | sudo tee -a /etc/fstab