12

I am trying to mount a partition on a GPT disk, but I get the following error:

$ sudo mount -t ext4 /dev/sda1 disk/
mount: special device /dev/sda1 does not exist

Looking at dmesg, I don't see any errors on /dev/sda:

$ dmesg | grep sda
[    1.367508] sd 0:0:0:0: [sda] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    1.367514] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    1.367607] sd 0:0:0:0: [sda] Write Protect is off
[    1.367611] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.367654] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.367936]  sda:
[    1.392417] sd 0:0:0:0: [sda] Attached SCSI disk

fdisk reports the GPT partition:

$ sudo fdisk -l /dev/sda

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
256 heads, 63 sectors/track, 363376 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       45423   366283322+  ee  GPT
Partition 1 does not start on physical sector boundary.

parted fails:

$ sudo parted /dev/sda print
Error: /dev/sda: unrecognised disk label

Kernel seems to have support for EFI (How to mount a partition on a disk that has an EFI GPT partition table in Debian GNU/Linux 5.0.3 (Lenny))

$ cat /boot/config-2.6.32-5-amd64 | grep EFI
CONFIG_EFI=y
CONFIG_FB_EFI=y
CONFIG_EFI_VARS=m
CONFIG_CACHEFILES=m
# CONFIG_CACHEFILES_DEBUG is not set
# CONFIG_CACHEFILES_HISTOGRAM is not set
CONFIG_EFI_PARTITION=y

How can I mount this GPT partition?

EDIT: I've just attached the same disk that is failing to another machine and I can see the contents without a hitch. Putting it back to the original box, I am having the same issue.

Paulo Tomé
  • 3,782
Hamza
  • 347
  • 2
  • 6
  • 16
  • 2
    I've got exactly the same problem as you - did you ever solve it? – Eborbob Oct 15 '15 at 14:46
  • I thought I had this problem, but turned out I was trying to mount /dev/sda rather than /dev/sda1. Worked without a hitch (even with a large GPT disc) once I switched that. – cag51 Apr 12 '19 at 18:30

3 Answers3

9

You cannot use fdisk to work with GPT disks, it will only work with MBR disks. Any disk that > 2TB must be GPT.

You likely cannot mount this HDD because even though the kernel has detected it (in the dmesg output) the HDD hasn't been partitioned or formatted with a filesystem so that it can be mounted.

Try the following to do this:

$ sudo sfdisk -l

This will list all the GPT devices & partitions. You can create a partition using sfdisk as well.

$ sudo sfdisk /dev/sda

After you've created a partition using sfdisk you'll want to format it:

$ mkfs.ext4 /dev/sda1

With the above done you should then be able to mount the HDD as you were originally attempting.

Determining a HDD's filesystem

If you're unsure how a HDD and/or partition may have been formatted you can use the command dumpe2fs to accomplish this.

$ sudo dumpe2fs /dev/sda1 | less

Parsing the output from this command is covered in this U&L Q&A titled: Reliable way to detect ext2 or ext3 or ext4?

References

slm
  • 369,824
  • 1
    Thanks, the troubling thing is: This is not a new disk, I have been using it for almost a year and I'm absolutely certain that there is (or was) an ext4 volume in there. – Hamza Apr 25 '14 at 20:49
  • @Hamza - the lack of a /dev/sda1 in dmesg means the kernel is not auto detecting any useful filesystem on it. Do you have other EXT4 devices mounted? That would confirm that the drivers are available/working so that EXT4 devices can be mounted. – slm Apr 25 '14 at 20:51
  • Yes, there are four other disks with a number of ext4 partitions mounted on the same machine. – Hamza Apr 25 '14 at 20:53
  • @Hamza - output of sfdisk -l? – slm Apr 25 '14 at 20:56
  • Disk /dev/sda: 364801 cylinders, 255 heads, 63 sectors/track Warning: The partition table looks like it was made for C/H/S=*/256/63 (instead of 364801/255/63). For this listing I'll assume that geometry. Units = cylinders of 8257536 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start End #cyls #blocks Id System /dev/sda1 0+ 45422- 45423- 366283322+ ee GPT /dev/sda2 0 - 0 0 0 Empty /dev/sda3 0 - 0 0 0 Empty /dev/sda4 0 - 0 0 0 Empty

    – Hamza Apr 25 '14 at 21:04
  • Sorry about formatting. – Hamza Apr 25 '14 at 21:05
  • I've just attached the same disk that is failing to another machine and I can see the contents without a hitch. This keeps getting stranger :) – Hamza Apr 25 '14 at 21:37
  • @Hamza - try using mount --verbose ... for additional info on why it's unsuccessful. Also /dev/sda and /dev/sda1 are showing up as device labels on the misbehaving box? Please confirm this, assuming they are given your fdisk output but just want to check it off the list. – slm Apr 25 '14 at 21:40
  • They do show up as device labels, the output of mount --verbose is still: mount: special device /dev/sda1 does not exist – Hamza Apr 26 '14 at 11:17
  • @Hamza - can you try getting the output of strace mount -t ext4 /dev/sda1 disk/? Please attach this to your Q or use http://pastebin.com/ and include the URL here. – slm Apr 26 '14 at 17:58
3

Forget about fdisk, use parted -l or gdisk -l (from package gptfdisk) instead ...

HalosGhost
  • 4,790
nowak
  • 49
  • 2
    Welcome to *nix.SE! One-line opinion-based answers like this are often not too helpful. Please consider explaning why these other options might be better; using links and documentation as references will further benefit the quality of your suggestion. – HalosGhost Sep 23 '14 at 23:59
2

Having had exactly the same issue as you, by solution was to use a different SATA controller. The problem occurred when the drive in question was connected via a USB SATA controller. In order to access the drive I unplugged the DVD drive from the motherboard onboard SATA controller (I have no spare sockets) and plugged the drive in (no reboot required - SATA is hot pluggable).

Eborbob
  • 123