Checking Hard Drive health on GNU/Linux (Part II) or ntfs-3g problems

In the previous entry we discard the hardware problem, so it’s time to hunt the software problem.

As far as I know NTFS file systems are managing by ntfs-3g package in Debian 8 so my next idea was test if this I/O error happened with other kind of file systems, VFAT for example. So I reformatted a USB stick as VFAT and mount the stick keeping the same mount options.

# mount -o rw,noexec,relatime,nosuid,nodev,noauto,user,uid=1000,gid=1000 /dev/sdc1 /mnt/seagate 

And surprisingly I didn’t get the I/O error message, so it seemed clear that the problem it was related with NTFS driver, so my next step was to reinstall ntfs-3g package, but backing up first the current package versions and its dependencies, just in case (I didn’t find software packages in /var/cache/apt/archives so I had to use aptitude download command):

 $ aptitude show ntfs-3g
 Package: ntfs-3g
 State: installed
 Version: 1:2014.2.15AR.2-1
 Maintainer: Laszlo Boszormenyi (GCS)
 Architecture: amd64
 Uncompressed Size: 1,542 k
...
 Description: read/write NTFS driver for FUSE
 NTFS-3G uses FUSE (Filesystem in Userspace) to provide support for the NTFS filesystem used by Microsoft Windows.

 # aptitude download ntfs-3g libc6 libgcrypt20 libgnutls-deb0-28 libgpg-error0 fuse
 # aptitude remove ntfs-3g
 # aptitude purge ntfs-3g
 # aptitude dist-upgrade
 # aptitude install ntfs-3g
 The following NEW packages will be installed:
 ntfs-3g
 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 Need to get 488 kB of archives. After unpacking 1,542 kB will be used.
 Get: 1 http://http.us.debian.org/debian/ testing/main ntfs-3g amd64 1:2014.2.15AR.2-1 [488 kB]
 Fetched 488 kB in 1s (247 kB/s)
 Selecting previously unselected package ntfs-3g.
 (Reading database ... 295573 files and directories currently installed.)
 Preparing to unpack .../ntfs-3g_1%3a2014.2.15AR.2-1_amd64.deb ...

And I tried mount NTFS device again.

# mount -o rw,noexec,relatime,nosuid,nodev,noauto,user,uid=1000,gid=1000 /dev/sdc1 /mnt/seagate
 ...
 Apr 6 12:37:24 lab kernel: [ 4388.388137] usb 2-1: new high-speed USB device number 3 using ehci_hcd
 Apr 6 12:37:24 lab kernel: [ 4388.522685] usb 2-1: New USB device found, idVendor=03f0, idProduct=1a40
 Apr 6 12:37:24 lab kernel: [ 4388.522695] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
 Apr 6 12:37:24 lab kernel: [ 4388.522702] usb 2-1: Product: v285w
 Apr 6 12:37:24 lab kernel: [ 4388.522707] usb 2-1: Manufacturer: HP
 Apr 6 12:37:24 lab kernel: [ 4388.522712] usb 2-1: SerialNumber: AA00000000013194
 Apr 6 12:37:24 lab mtp-probe: checking bus 2, device 3: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
 Apr 6 12:37:24 lab mtp-probe: bus: 2, device: 3 was not an MTP device
 Apr 6 12:37:24 lab kernel: [ 4388.563051] Initializing USB Mass Storage driver...
 Apr 6 12:37:24 lab kernel: [ 4388.563331] scsi6 : usb-storage 2-1:1.0
 Apr 6 12:37:24 lab kernel: [ 4388.563554] usbcore: registered new interface driver usb-storage
 Apr 6 12:37:24 lab kernel: [ 4388.563560] USB Mass Storage support registered.
 Apr 6 12:37:26 lab kernel: [ 4390.110794] scsi 6:0:0:0: Direct-Access hp v285w 1100 PQ: 0 ANSI: 4
 Apr 6 12:37:26 lab kernel: [ 4390.112745] sd 6:0:0:0: Attached scsi generic sg2 type 0
 Apr 6 12:37:26 lab kernel: [ 4390.114560] sd 6:0:0:0: [sdc] 31405824 512-byte logical blocks: (16.0 GB/14.9 GiB)
 Apr 6 12:37:26 lab kernel: [ 4390.115176] sd 6:0:0:0: [sdc] Write Protect is off
 Apr 6 12:37:26 lab kernel: [ 4390.115184] sd 6:0:0:0: [sdc] Mode Sense: 43 00 00 00
 Apr 6 12:37:26 lab kernel: [ 4390.118133] sd 6:0:0:0: [sdc] No Caching mode page present
 Apr 6 12:37:26 lab kernel: [ 4390.118142] sd 6:0:0:0: [sdc] Assuming drive cache: write through
 Apr 6 12:37:26 lab kernel: [ 4390.128356] sd 6:0:0:0: [sdc] No Caching mode page present
 Apr 6 12:37:26 lab kernel: [ 4390.128366] sd 6:0:0:0: [sdc] Assuming drive cache: write through
 Apr 6 12:37:26 lab kernel: [ 4390.129374] sdc: sdc1
 Apr 6 12:37:26 lab kernel: [ 4390.132325] sd 6:0:0:0: [sdc] No Caching mode page present
 Apr 6 12:37:26 lab kernel: [ 4390.132333] sd 6:0:0:0: [sdc] Assuming drive cache: write through
 Apr 6 12:37:26 lab kernel: [ 4390.132341] sd 6:0:0:0: [sdc] Attached SCSI removable disk...
 $ mount|grep sdc1
 /dev/sdc1 on /mnt/seagate type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,user)

Unfortunately the same error is launched :(. My next thought was if there were wrong mount options to NTFS so I’m going to try with mount options by default just to test:

# mount -t ntfs-3g /dev/sdc1 /mnt/seagate
 ....
 Apr 6 12:40:00 lab ntfs-3g[26275]: Unmounting /dev/sdc1 ()
 Apr 6 12:40:41 lab ntfs-3g[26516]: Version 2014.2.15AR.2 integrated FUSE 28
 Apr 6 12:40:41 lab ntfs-3g[26516]: Mounted /dev/sdc1 (Read-Write, label "", NTFS 3.1)
 Apr 6 12:40:41 lab ntfs-3g[26516]: Cmdline options: rw
 Apr 6 12:40:41 lab ntfs-3g[26516]: Mount options: rw,allow_other,nonempty,relatime,fsname=/dev/sdc1,blkdev,blksize=4096
 Apr 6 12:40:41 lab ntfs-3g[26516]: Ownership and permissions disabled, configuration type 7
 ...

 $ mount|grep sdc1
 /dev/sdc1 on /mnt/seagate type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
$ cd /mnt/seagate
$ ls

Executing ‘ls’ command was the point where I/O error was launched, so my previous mount options are causing the I/O problem!!

Let’s to compare mount options:

Wrong: # mount -o rw,noexec,relatime,nosuid,nodev,noauto,user,uid=1000,gid=1000 /dev/sdc1 /mnt/seagate
 /dev/sdc1 on /mnt/seagate type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,user)
 Right: # mount -t ntfs-3g /dev/sdc1 /mnt/seagate
 /dev/sdc1 on /mnt/seagate type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

If you take a look to man page the mount options which are being used in the wrong mount command:

nosuid: Do not allow set-user-identifier or set-group-identifier bits to take effect.
nodev: Do not interpret character or block special devices on the file system.
noexec: Do not permit direct execution of any binaries on the mounted filesystem. (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)
noauto: Can only be mounted explicitly (i.e., the -a option will not cause the filesystem to be mounted).
user: Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab (or to the private libmount file in /run/mount on system without regular mtab) so that he can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).

First test modifying mount options:

# mount -o rw,relatime,nosuid,noauto,user,uid=1000,gid=1000 /dev/sdc1 /mnt/seagate/
 /dev/sdc1 on /mnt/seagate type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,user)
$ cd /mnt/seagate
 bash: cd: /mnt/seagate: Input/output error

Second try:

# mount -o rw,user_id=1000,group_id=1000 /dev/sdc1 /mnt/seagate

Enable -o debug to mount command:

Version 2014.2.15AR.2 integrated FUSE 28
 Cmdline options: rw,noatime,noexec,nosuid,nodev,debug,uid=1000,gid=1000,user
 Mount options: rw,noexec,nosuid,nodev,user,allow_other,nonempty,noatime,default_permissions,fsname=/dev/sdc1,blkdev,blksize=4096
 Global ownership and permissions enforced, configuration type 7
 unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
 INIT: 7.17
 flags=0x0000047b
 max_readahead=0x00020000
 INIT: 7.8
 flags=0x00000001
 max_readahead=0x00020000
 max_write=0x00020000
 unique: 1, error: 0 (Success), outsize: 40

About I/O Error I found this entry in Debian forum. I wanted to follow a different approach and I try the latest stable version from here so:

$ mkdir /opt/ntfs
$ ./configure --prefix=/opt/ntfs --exec-prefix=/opt/ntfs
$ make
# make install
$ /opt/ntfs/bin/ntfs-3g --help
ntfs-3g 2014.2.15AR.3 integrated FUSE 27 - Third Generation NTFS Driver
Configuration type 1, XATTRS are on, POSIX ACLS are off
Apr 6 17:35:26 lab ntfs-3g[6572]: Version 2014.2.15AR.3 integrated FUSE 27
 Apr 6 17:35:26 lab ntfs-3g[6572]: Mounted /dev/sdc1 (Read-Write, label "", NTFS 3.1)
 Apr 6 17:35:26 lab ntfs-3g[6572]: Cmdline options: rw,noatime,noexec,nosuid,nodev,uid=1000,gid=1000,user
 Apr 6 17:35:26 lab ntfs-3g[6572]: Mount options: rw,noexec,nosuid,nodev,user,allow_other,nonempty,noatime,default_permissions,fsname=/dev/sdc1,blkdev,blksize=4096
 Apr 6 17:35:26 lab ntfs-3g[6572]: Global ownership and permissions enforced, configuration type 1

This line has changed when I mount a NTFS device in my syslog:
Global ownership and permissions enforced, configuration type 7 -> Global ownership and permissions enforced, configuration type 1

I’ve tested with my original mount options and no I/O errors are being launched! My problem was fixed but I found this bug opened so should be careful.


“It is not the strongest of the species that survives, nor the most intelligent that survives. It is the one that is the most adaptable to change.”
–Charles Darwin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s