Skip to content
Posts en inglés. Usá el traductor del navegador para leerlos en tu idioma.

Build a High-Speed External NVMe SSD with Thunderbolt on Linux

Yammbo
· 7 min read
external ssd setup linux storage nvme enclosure boltctl fdisk ext4
Build a High-Speed External NVMe SSD with Thunderbolt on Linux

External storage is essential for many workflows, from large project files to quick backups. While USB drives are common, an external NVMe SSD connected via Thunderbolt offers significantly higher speeds, rivaling internal storage. This tutorial guides you through selecting the right components, assembling your high-speed drive, and configuring it for optimal performance on a Linux system.

Step 1: Choosing the Right NVMe SSD Enclosure and Drive

The foundation of your high-speed external storage is the enclosure and the NVMe SSD itself. Compatibility is key to ensuring you achieve the promised speeds and functionality.

Enclosure Considerations:

  • Thunderbolt Version: Look for enclosures that support Thunderbolt 3, 4, or 5. Thunderbolt 3 and 4 offer up to 40Gbps (approximately 2500-3000 MB/s real-world speeds), while Thunderbolt 5 boasts 80Gbps (up to 6000 MB/s). Ensure your computer's Thunderbolt port matches or exceeds the enclosure's version for maximum performance. Backward compatibility usually means a lower speed cap.
  • NVMe Support: Confirm the enclosure is specifically designed for NVMe M.2 SSDs, not SATA M.2. SATA drives use a different protocol and keying (B-key or B+M key), offering much lower speeds.
  • Form Factor: Most enclosures support the 2280 (22mm wide, 80mm long) M.2 NVMe SSDs. Some might also support 2230, 2242, or 2260, but 2280 is the most common and offers the widest range of SSD choices. Check your SSD's length before purchasing.
  • Thermal Management: High-speed NVMe SSDs generate heat. Enclosures with aluminum bodies, heatsinks, or thermal pads/paste are crucial for sustained performance. Fanless designs are silent but rely heavily on passive cooling.
  • Cable: A high-quality, certified Thunderbolt cable is essential. Many enclosures include one, but if not, ensure you purchase one rated for the appropriate Thunderbolt version and speed.

NVMe SSD Considerations:

  • PCIe Generation: For the best performance, pair a PCIe Gen4 or Gen5 NVMe SSD with a compatible enclosure and Thunderbolt port. While PCIe Gen3 drives will work, they won't fully utilize the bandwidth of Thunderbolt 4 or 5.
  • Capacity: Choose a capacity that meets your needs. Enclosures typically support up to 4TB or more.
  • NAND Type: SSDs use different NAND types (QLC, TLC, MLC). QLC (Quad-Level Cell) drives are generally more affordable but can see performance degradation during very large, sustained writes as their SLC cache fills up. TLC (Triple-Level Cell) and MLC (Multi-Level Cell) drives offer better sustained write performance and endurance.
  • Heatsinks: If your chosen SSD comes with a pre-attached heatsink, ensure it will physically fit within the enclosure. Many slim enclosures are designed for bare SSDs and may not accommodate bulky heatsinks.

Step 2: Installing Your NVMe SSD into the Enclosure

Once you have your enclosure and NVMe SSD, the physical installation is straightforward. This process typically requires a small Phillips head screwdriver.

  1. Open the Enclosure: Carefully open the enclosure according to its design. This usually involves sliding open a cover, removing screws, or unlatching clips.
  2. Insert the NVMe SSD: Locate the M.2 slot inside the enclosure. Align the notch on your NVMe SSD with the key in the slot. Gently push the SSD into the slot at an angle (usually around 30 degrees) until it seats firmly. Do not force it.
  3. Secure the SSD: Once inserted, the SSD will likely be held down by a small screw or a tool-less plastic clip at the opposite end of the connector. Secure it to keep the drive flat and stable.
  4. Apply Thermal Material (Optional but Recommended): If your enclosure came with thermal pads or thermal paste, apply them now. Thermal pads typically adhere to the SSD's controller chips and then to the enclosure's metal body for heat transfer. If using thermal paste, apply a small amount to the main controller chip on the SSD. This helps dissipate heat and prevents thermal throttling during heavy use.
  5. Close the Enclosure: Reassemble the enclosure, ensuring all screws are tightened or clips are secured. Double-check that the enclosure is fully closed and protected.

Step 3: Connecting and Initializing on Linux

With your NVMe SSD installed, it's time to connect it to your Linux machine. Thunderbolt devices often require authorization on Linux for security reasons.

  1. Connect the Enclosure: Plug one end of your Thunderbolt cable into the enclosure and the other into a Thunderbolt port on your Linux computer.
  2. Verify Thunderbolt Connection: Open a terminal and use the boltctl command to list connected Thunderbolt devices.
  3. boltctl list

    You should see your enclosure listed, possibly under a generic manufacturer name or a device ID. If it's not authorized, you might see its status as 'disconnected' or 'not authorized'.

  4. Authorize the Device (if necessary): If the device is not automatically authorized, you can authorize it manually using its UUID (Universally Unique Identifier) from the boltctl list output.
  5. boltctl authorize [device_uuid]

    For instance, if your device's UUID is a1b2c3d4-e5f6-7890-1234-567890abcdef, the command would be boltctl authorize a1b2c3d4-e5f6-7890-1234-567890abcdef. Many modern distributions with desktop environments will automatically prompt for authorization or authorize known devices.

    Once authorized, the device should show a '40 Gb/s' or '80 Gb/s' link speed, indicating a successful Thunderbolt connection.

  6. Identify the Drive: The NVMe SSD will typically appear as a standard block device. Use lsblk to identify its device name (e.g., /dev/nvme0n1 or /dev/nvme1n1).
  7. lsblk

    Look for a new disk entry with the size of your NVMe SSD. It might not have any partitions yet.

Step 4: Formatting and Mounting the External SSD

Before you can use the drive, you need to create a partition table, format it with a filesystem, and mount it.

  1. Create a Partition Table: Use fdisk or gparted (graphical) to create a new partition table. For modern drives, GPT (GUID Partition Table) is recommended over MBR (Master Boot Record). Replace /dev/nvmeXnY with your identified device name.
  2. sudo fdisk /dev/nvmeXnY

    Inside fdisk:

    • Press g to create a new GPT partition table.
    • Press n to create a new partition. Accept the default partition number, first sector, and last sector to use the entire disk.
    • Press w to write the changes and exit.
  3. Format the Partition: Now, format the newly created partition (e.g., /dev/nvmeXnYp1) with your desired filesystem. ext4 is a common choice for Linux.
  4. sudo mkfs.ext4 /dev/nvmeXnYp1

    You can choose other filesystems like XFS or Btrfs if they better suit your needs.

  5. Create a Mount Point: Create a directory where you want to access your external SSD.
  6. sudo mkdir /mnt/external_nvme
  7. Mount the Drive: Mount the formatted partition to your new mount point.
  8. sudo mount /dev/nvmeXnYp1 /mnt/external_nvme

    You can verify it's mounted correctly with df -h.

  9. Configure for Automatic Mounting (Optional): To have the drive mount automatically at boot, add an entry to your /etc/fstab file. First, get the UUID of your partition:

    sudo blkid /dev/nvmeXnYp1

    Then, open /etc/fstab with a text editor (e.g., sudo nano /etc/fstab) and add a line like this, replacing the UUID and mount point as appropriate:

    UUID=[your_partition_uuid] /mnt/external_nvme ext4 defaults,nofail 0 2

    The nofail option prevents your system from failing to boot if the external drive isn't connected.

Step 5: Verifying Drive Health and Performance

With your external NVMe SSD configured, you can perform checks to ensure its health and understand its performance characteristics.

  1. Check SMART Data: NVMe SSDs expose Self-Monitoring, Analysis, and Reporting Technology (SMART) data, which provides insights into the drive's health and operational statistics. Since Thunderbolt tunnels PCIe, the drive appears as a native NVMe device, allowing direct access to this data.
  2. sudo nvme smart-log /dev/nvmeXnY

    This command will display various metrics, including temperature, critical warnings, available spare capacity, and data units read/written. Monitoring temperature is particularly important for external enclosures, especially during sustained heavy loads.

  3. Benchmark Performance (Optional): To get an idea of your drive's actual read/write speeds, you can use benchmarking tools like fio or dd.
  4. For a simple write test:

    dd if=/dev/zero of=/mnt/external_nvme/testfile bs=1G count=10 oflag=direct status=progress

    This command writes 10GB of zeros to a file and reports the speed. Remember that sustained writes on QLC NAND drives might slow down after the SLC cache is exhausted.

    For a simple read test (after writing a file):

    sudo sh -c