As Preston Kutzner recently said to me, NTFS is a harsh mistress when accessing it via Linux. I am using Fedora 14 and have a LaCie 2big external hard drive connected via USB. The 2big is configured as a RAID 1 set using it’s own built-in RAID hardware. When I try to open the drive in Nautilus I receive the following error:
Unable to mount LaCie 2Big.
Error mounting: mount exited with exit code 12: Failed to read last sector (1953519615): Invalid argument
- Either the volume is a RAID/LDM but it wasn’t setup yet,
- or it was not setup correctly (e.g. by not using mdadm –build …),
- or a wrong device is tried to be mounted,
- or the partition table is corrupt (partition is smaller than NTFS),
- or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount ‘/dev/sdc1’: Invalid argument. The device ‘/dev/sdc1’ doesn’t seem to have a valid NTFS. Maybe the wrong device is used? Or the whole disk instead of a partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
Being new to the world of Happy Little Penguins I spent a full day Googling, learning plenty of new things at every step and button mashing in the form of running shell commands that I had only just learned about moments earlier.
I’m certain that through this whole ordeal a solution existed and that evidences of the problem were staring me in the face the whole time. I am further certain that a more elegant solution existed than the scorched-earth one that I chose (that you will find out about in just a moment), but I am too much of a neophyte to pick up on them much less be able to act on anything I might have noticed.
I could see the 2big in the /dev folder at /dev/sdc1. The 2Big is listed in /dev/disk/by-id as the following:
It is listed in by-label as the following:
It is listed in by-path as the following:
Finally, it is listed by-uuid as the following:
lrwxrwxrwx. 1 root root 10 Mar 2 14:29 3E421CD2421C90AF -> ../../sdc1
fdisk -l /dev/sdc shows the following:
Disk /dev/sdc: 1000.2 GB, 1000153686016 bytes 255 heads, 63 sectors/track, 121595 cylinders, total 1953425168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe7479c04 Device Boot Start End Blocks Id System /dev/sdc1 2048 1953521663 976759808 7 HPFS/NTFS
I created a new folder /mnt/2big and ran mount /dev/sdc1 /mnt/2big and received the same error as I did in Nautilius (as if I wouldn’t have?). I decided to search the generic error, rather than focus on anything to do with the LaCie drive. “Error mounting: mount exited with exit code 12” brought back some interesting things. One of the “solutions” was to reformat the disk with gparted. That is not an option I wanted to exercise unless as a last resort.
I then tried: ntfsfix /dev/sdc1
Mounting volume... OK Processing of $MFT and $MFTMirr completed successfully. NTFS volume version is 3.1. NTFS partition /dev/sdc1 was processed successfully.
I then rebooted into Windows expecting that a chkdsk would be automatically requested to be performed. It was not, so I booted back in Linux to try a few more things before attempting a manual chkdsk within Windows. I installed testdisk thinking that I could perform some kind of partition table rebuild with it. After analyzing the 2big I received this interesting error:
Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121596 255 63 The harddisk (1000 GB / 931 GiB) seems too small! (< 1000 GB / 931 GiB) Check the harddisk size: HD jumpers settings, BIOS detection... The following partition cant be recovered: Partition Start End Size in sectors HPFS - NTFS 0 32 33 121601 25 24 1953519616 [LaCie 2Big] [ Continue ] NTFS, 1000 GB / 931 GiB
At about that point, someone wondered what NTFS driver I was using so I made sure that I was using ntfs-3g. I then decided to use Cfdisk to do some probing. Cfdisk /dev/sdb1 got me this error:
FATAL ERROR: Bad primary partition 0: Partition ends after end-of-disk
So apparently the partition was sized larger than the disk. And Windows is okay with this and will perform without complaint? No attempt to fix it is made? Insert angry face here.
I then plugged the 2big into a Windows Vista machine intending to chkdsk it, but as the disk was being mounted I saw a dialog box warning “Do you want to scan and fix LaCie 2big? There might be a problem with some files on this device or disc. This can happen if you remove the device or disc before all files have been written to it.” Interesting, so suddenly there was some kind of file system error detected. There was an option to scan and fix, but since I was not 100% sure what command would be run, I continued without scanning. Instead I manually ran chkdsk using the /F /V and /X options (Fix errors, show messages and force volume dismount respectively). I plugged the drive into Fedora but still received the same errors as before when mounting it.
At that point, quite a lot of time had been spent researching and testing, so I decided on the easy fix. I had already synced the 2big to another drive before attempting this project so I gparted it (I was too lazy to even try parted), created a new partition and then copied everything back to the 2big. Problem “solved”.
I know that there was likely a less destructive way of ending that saga, but I haven’t had sufficient beatings with the Linux cluebat to know how. Is dealing with NTFS always this frustrating on Linux? What practices and standards has Microsoft been using with how Windows interacts with NTFS volumes that it can apparently have an unhealthy partition table and still work without warning or fixing the problem? I’d seriously consider using ext4 for all my drives and using a plugin like Ext2Read within my windows machines if I didn’t often physically share some drives with other people’s Windows machines.
What are your experiences with NTFS on *NIX machines? Exceedingly painful or am I doing it wrong?