When I first connected my new hard drive enclosure with 4TB drive to my Pi, the drive was not listed when I typed sudo fdisk -l. I want to mount this drive, but I think I first need to partition it and add a file system. What to do? Are there special considerations, given that this is a very large drive?

At one point I thought I had it formatted correctly, but then I noticed the Pi only knew about 2.2TB of the total space (As reported by df -H).

I should also mention that the hard disk enclosure is powered. I'm connecting it through a powered USB hub at the moment too.


  • Insignia USB 3.0 Desktop Hard Disk Drive Enclosure (NS-PCHD335)
  • Seagate 4TB SATA Desktop HDD (STBD4000400)
  • Insignia USB 3.0 Hub with power supply (NS-PCH5431)

There are a few things that you need to do to get this to work. First, after physically connecting the drive, run dmesg to see the name of the node in /dev. You should find something like this:

[ 5155.744879] usb-storage 1-1.4.3:1.0: USB Mass Storage device detected
[ 5155.753654] scsi host1: usb-storage 1-1.4.3:1.0
[ 5157.013418] scsi 1:0:0:0: Direct-Access     ST4000DM 000-1F2168            PQ: 0 ANSI: 6
[ 5157.015712] sd 1:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
[ 5157.085733] sd 1:0:0:0: Attached scsi generic sg0 type 0

sda is the /dev node above, and you can see that it is there via ls /dev/sd*.

Assuming this is a new drive, you may only see /dev/sda (or sdb or whatever the node was named), while drives with partitions will have /dev/sda, /dev/sda1, where sda1 is the node for a partition.

With an unpartitioned disk, you will not see it listed if you execute fdisk -l. So you need to add a partition. fdisk is not the easiest tool for the job in this case, because you need to use the GPT partitioning scheme. fdisk will try to use MBR. But because of the way block addresses are stored in MBR, it is only able to index 2.2TB worth of addresses. That's why your drive looked like a 2.2TB drive to the OS, rather than 4TB.

Do this next:

sudo apt-get install gdisk

gdisk will let you create a GPT partition. Type 'p' at the prompt to list any current partitions. Type 'd' to delete partitions. Type 'n' to make a new partition. Assign it the number 1 when prompted. Type 'w' to write the changes. You can see your partition now using fdisk -l. I'll assume it is named sda1.

With a partition in place you need a filesystem. To accomplish that:

sudo mkfs.ext4 /dev/sda1 -L gargantua

The -L option allows you to set a volume label. I used 'gargantua' for reasons. The .ext4 gives us an ext4 filesystem, which is recommended for the Pi.

Now that you have a partition with a file system, you can mount it:

mkdir /home/pi/drives/gargantua # or wherever...
sudo mount /dev/sda1 /home/pi/drives/gargantua/
df -H

df should show you that you have 4TB available and that the drive is mounted where you mounted it.

If you want to automount the drive at boot, you can use the GUID or the volume label. I'll use the label:

sudo cp /etc/fstab /etc/fstab.bk
sudo nano /etc/fstab

You need to add this line, or one more suited to your purposes to /etc/fstab:

LABEL=gargantua /home/pi/drives/gargantua ext4 defaults 0       2

The Wikipedia page on fstab gives decent examples and descriptions for editing fstab, if you need more information.

And that should do it, you have a very very big drive that mounts to the same location whenever it is attached to the Pi or its USB hub.

| improve this answer | |
  • Glad it helped :) – Rab Feb 23 '19 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.