📄 Author: Ouail Zakary
- 📧 Email: Ouail.Zakary@oulu.fi
- 🔗 ORCID: 0000-0002-7793-3306
- 🌐 Website: cc.oulu.fi/~nmrwww/members/Ouail_Zakary.html
- 📁 Personal Website: ozakary.github.io
This guide explains how to set up and use hard drives with a USB docking station on Ubuntu Linux. This process was tested with a dual-bay hard drive docking station and two 4TB Seagate drives.
- Overview
- Hardware Setup
- Initial Detection
- Common Issues
- Setting Up a New Drive
- Final Verification
- Daily Usage
- Troubleshooting
What you need:
- Hard drive docking station with USB connection
- One or more hard drives (SATA)
- Ubuntu Linux system (tested on Ubuntu 22.04)
- Administrator (sudo) access
What this does NOT require:
- The "cloning" feature mentioned in the docking station manual is OPTIONAL and NOT needed for normal storage use
- You only need cloning if you want to duplicate one drive to another
- Connect the USB cable from the docking station to your laptop
- Insert your hard drive(s) into the docking station slots (HDD A and/or HDD B)
- Connect the AC/DC power adapter to the docking station and wall socket
- The drives should power on (you may see indicator lights)
Important: Do NOT use the cloning feature unless you specifically want to duplicate one drive to another. For normal storage use, just connect and use the drives.
Open a terminal and run:
lsblkWhat to look for:
- New devices named
sdb,sdc,sdd, etc. (depends on what's already connected) - The size should match your hard drive capacity (e.g., 3.6T for a 4TB drive)
Example output:
NAME SIZE TYPE MOUNTPOINT
sda 931.5G disk
└─sda1 931.5G part /media/user/existing_drive
sdc 3.6T disk ← New 4TB drive
nvme0n1 953.9G disk
├─nvme0n1p1 512M part /boot/efi
└─nvme0n1p2 953G part /
sudo fdisk -l /dev/sdcReplace sdc with your actual device name.
If you see partitions listed, the drive may have data. If you see "RAID" or "md" devices, see the RAID Cleanup section below.
If your drive was previously used in a RAID array (common with enterprise drives), you'll see inactive RAID devices:
cat /proc/mdstatExample problematic output:
md126 : inactive sdc[0]
3906469888 blocks super external:/md127/1
Solution: See the RAID Cleanup section below.
This section covers setting up a drive from scratch (or after wiping an existing drive).
If the drive has RAID metadata, clean it up first:
# Stop any inactive RAID arrays
sudo mdadm --stop /dev/md126
sudo mdadm --stop /dev/md127
# Wipe RAID metadata from the drive
sudo mdadm --zero-superblock /dev/sdcReplace sdc with your actual device name.
sudo fdisk /dev/sdcIn the fdisk prompt, type these commands:
- Type
gand press Enter (creates GPT partition table - required for drives >2TB) - Type
nand press Enter (creates new partition) - Press Enter (accept default partition number)
- Press Enter (accept default first sector)
- Press Enter (accept default last sector - uses entire disk)
- Type
wand press Enter (write changes and exit)
Expected output:
Created a new GPT disklabel (GUID: ...)
Created a new partition 1 of type 'Linux filesystem' and of size 3.6 TiB.
The partition table has been altered.
sudo mkfs.ext4 /dev/sdc1Note: This will take a few minutes for large drives. You'll see progress messages.
Expected output:
Creating filesystem with 976754385 4k blocks and 244195328 inodes
Filesystem UUID: 8a84db63-36b2-44ec-8e68-8a3d6b47e3bb
...
Writing inode tables: done
Creating journal: done
Writing superblocks and filesystem accounting information: done
After formatting, safely remove and re-plug the USB cable. Ubuntu will automatically detect and mount the drive with its UUID as the folder name.
Check where it's mounted:
lsblkYou should see something like:
sdc 3.6T disk
└─sdc1 3.6T part /media/username/8a84db63-36b2-44ec-8e68-8a3d6b47e3bb
The UUID names are long and hard to remember. Create symbolic links for easier access:
# For the first drive
ln -s /media/username/8a84db63-36b2-44ec-8e68-8a3d6b47e3bb ~/hdd1
# For the second drive (if you have one)
ln -s /media/username/3fda220b-c107-4b75-97bc-05e5c3a5335c ~/hdd2Replace:
usernamewith your actual Ubuntu username- The UUID strings with the actual UUIDs from your
lsblkoutput
Now you can access your drives as ~/hdd1 and ~/hdd2!
# Test writing to the drive
echo "Test file" > ~/hdd1/test.txt
# Test reading from the drive
cat ~/hdd1/test.txt
# Check available space
df -h ~/hdd1Expected output:
Test file
Filesystem Size Used Avail Use% Mounted on
/dev/sdc1 3.6T 36K 3.4T 1% /media/username/...
Simply use the shortcuts you created:
# Copy files to the drive
cp my_data.tar.gz ~/hdd1/
# List files on the drive
ls ~/hdd1/
# Check disk usage
df -h ~/hdd1Always safely eject before unplugging:
-
GUI method: Right-click the drive icon and select "Safely Remove" or "Eject"
-
Command line method:
# Unmount the drive sudo umount ~/hdd1 # Or unmount by device sudo umount /dev/sdc1
-
Wait for the command to complete
-
Unplug the USB cable or power off the docking station
When you plug the drives back in:
- Ubuntu will auto-mount them with the same UUID names
- Your symbolic links (
~/hdd1,~/hdd2) will work automatically - The device names (
sdc,sdd) may change, but the mount points stay consistent
Check physical connections:
lsusb # Should show the docking station
dmesg | tail -30 # Check for USB device messagesCheck if drive is detected but not mounted:
lsblk
sudo fdisk -lThis usually means the drive connection was interrupted. Try:
# Unmount the problematic drive
sudo umount /media/username/UUID-name
# Check dmesg for errors
sudo dmesg | tail -50 | grep error
# Safely remove and re-plug the USB cable
# The drive should re-mount automaticallyThis is normal! Device names (sdc, sdd) can change between boots or when you unplug/replug drives. This is why we use:
- UUID-based mount points (handled automatically by Ubuntu)
- Symbolic links (
~/hdd1) for easy access
Your data is safe - only the device name changed, not the actual drive.
Check ownership and permissions:
ls -la /media/username/UUID-name/
# If owned by root, change ownership
sudo chown username:users /media/username/UUID-name/Replace username with your actual username. You can check your username with:
whoami
idIf using both bays in a dual-bay docking station:
- Each drive appears as a separate device (
sdc,sdd, etc.) - Each gets its own UUID-based mount point
- Create separate shortcuts for each:
~/hdd1,~/hdd2, etc. - You can access both drives simultaneously
lsblk
df -h | grep -v loopsudo apt install smartmontools
sudo smartctl -a /dev/sdclsof +D ~/hdd1du -sh ~/hdd1/* # Size of each folder/file
df -h ~/hdd1 # Total space used/availableQuick setup for new drives:
- Connect docking station hardware
- Check detection:
lsblk - Clean RAID if needed:
sudo mdadm --zero-superblock /dev/sdc - Partition:
sudo fdisk /dev/sdc→g,n, Enter×3,w - Format:
sudo mkfs.ext4 /dev/sdc1 - Unplug and re-plug USB (Ubuntu auto-mounts)
- Create shortcut:
ln -s /media/username/UUID ~/hdd1 - Test:
echo "test" > ~/hdd1/test.txt
Daily usage:
- Access via
~/hdd1and~/hdd2 - Always safely eject before unplugging
- UUID names stay consistent across reboots
- Tested with Ubuntu 22.04 LTS
- Works with dual-bay USB 3.0 docking stations
- Suitable for 4TB Seagate ST4000NM drives (and other large drives)
- UUID-based mounting ensures consistency across reboots
- No need to use the docking station's "cloning" feature for normal storage use
For further details, please refer to the respective folders or contact the author via the provided email.