Write error on ntfs file system on ubuntu 8.04

I have an external USB drive that I formatted with an msdos label and an ntfs file system.  This was done as this drive is occasionally used to share data with a windoz box and I needed something compatible with windoz.

The initial mkfs and mount worked fine and I was able to put many files onto this disk (314 GB worth).  Then I rebooted the Linux (ubuntu) system and now I can mount the disk but it is acting as if it is mounted read-only.

I cannot create files or directories on the device.  I have umounted and remounted the disk several times explicitly specifying "-o rw" but the disk always acts like a read-only device.

I am doing all the copies, mounts, etc as root, and all the file and directories are 777 so I don't think it is a permissions problem.

When I attempt to touch a file (or mkdir, or cp, or cpio, or tar) here is what I get.

touch: cannot touch `jjv': Operation not supported

Any ideas???
Who is Participating?
russell124Connect With a Mentor Commented:
The ntfs volume might not have been removed clean the last time it was mounted in windows.  

You can clear this by re-mounting it in windows, and using the "Safely Remove Hardware" option, or you can run checkdisk on it from windows, or you can even try using ntfsfix from ubuntu, although it isn't technically a full checkdisk.

If you are worried about data integrity I would try using the windows methods.
jvosslerAuthor Commented:
I power cycled the device and looked in the messages file and everything looked fine:

May 20 13:30:07 pickles kernel: scsi 3:0:0:0: Direct-Access     Seagate  FreeAgent        102D PQ: 0 ANSI: 4
May 20 13:30:07 pickles kernel: sd 3:0:0:0: [sdb] 2930277168 512-byte hardware sectors (1500302 MB)
May 20 13:30:07 pickles kernel: sd 3:0:0:0: [sdb] Write Protect is off
May 20 13:30:07 pickles kernel: sd 3:0:0:0: [sdb] 2930277168 512-byte hardware sectors (1500302 MB)
May 20 13:30:07 pickles kernel: sd 3:0:0:0: [sdb] Write Protect is off
May 20 13:30:07 pickles kernel:  sdb: sdb1
May 20 13:30:07 pickles kernel: sd 3:0:0:0: [sdb] Attached SCSI disk
May 20 13:30:07 pickles kernel: sd 3:0:0:0: Attached scsi generic sg1 type 0

The /etc/mtab shows the device mounted rw

Still no joy.

LinuxNtwrkngConnect With a Mentor Commented:
Make sure you have the latest ntfs-3g installed.  I've heard of this exact problem with versions released prior to October or so of 2008, which your Ubuntu is from so if it's not been updated that may explain it.

In case you need them, the commands are:
'sudo apt-get update'
'sudo apt-get upgrade'
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

jvosslerAuthor Commented:
I did not have ntfs functionality (for mkfs.ntfs) until I installed a couple of days ago.  The system gets the update and upgrade at least once a month. I am confident that we have the latest versions.

The system did not go down cleanly when it was rebooted.  An anxious user thought it had frozen up and simply power cycled the Linux system.

Since this disk will rarely be connected to a windoz system I do not have easy access to use any of the tools suggested under windoz.

I ran ntfsfix on the device successfully, but when I then mounted it up I got the same errors.

Since this drive will only see a windoz system about once every 4 - 8 weeks I would not want to have my only option to connect to a system that isn't available.

I did notice that the mkfs command (mkfs -t ntfs /dev/sdb1) seemed to run very quickly, almost immediate.  Normally when I build a file system outside zfs it takes a bit of time.  I will rebuild the file system from scratch and see what happens, then report back.

I am open to rebuilding the disk with a different file system or other options.  The data currently on the disk is replicated elsewhere.  I need this disk to work with Linux 90%+ and occasionally connect to windoz.  So I am open to other suggestions.

jvosslerAuthor Commented:
I started building a new ntfs file system last night at about 20:30.  The process is still running at 06:30 and shows 57% completed.

The first time I did the mkfs the command returned almost immediately and now it looks to take around 17 hours completing some time near 14:30.

The output indicates that it is writing zeros

pickles:/> mkfs -t ntfs /dev/sdb1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes:  57%

This is my first experience dealing with windoz file systems, I'm not certain what to expect.  I usually only deal with Unix and Linux.

I would suggest going with a FAT partition if you aren't going to have any files bigger than 4 GB. Both Linux and Windows have built in FAT support, and In my experience FAT is the most painless system to use when you have a drive that needs to be used across Linux / Mac / Windows.

jvosslerAuthor Commented:
This is what drove me to ntfs.  Many of the files are over 8GB, the the external drive at 1.5TB.

The mkfs finished at around 15:00 - taking about 18 hours to complete.

I am again testing it by creating several directories and files etc.

It seems that the disk drive has the capacity to "sleep" and any initial mount command takes a while to complete.  The first mount may error out.  Once mounted if the disk sleeps it can take up to 30 seconds to wake up after an "ls", "df" or other command to access the disk.  I will be checking with the OEM about how to limit or deactivate this feature.

I still wonder about the difference between the mkfs command returning immediately the first time.  It was a new disk and had no data on it.  Could the previous data have triggered the much monger "zeroing" of the disk when the mkfs was run?

jvosslerAuthor Commented:
As I was attempting to populate the disk the disk went into the "read-only" mode again.

No reboot, no crash, just a "cpio -p.." running to the disk.  One of the directories looked interesting

ls -l
ls: cannot access Cinc: Input/output error
total 8
drwxrwxrwx  1 root root 4096 2009-05-22 03:05 .
drwxr-xr-x 40 root root 4096 2009-05-22 17:12 ..
d?????????  ? ?    ?       ?                ? Cinc
drwxrwxrwx  1 root root    0 2009-05-22 17:12 Full

I umount'ed the disk and then did a "mount -a" and everything came back and worked properly.  

Since I just purchased this 1.5TB disk, should I take it back to exchange it, or am I doing something incorrectly on this disk?
jvosslerAuthor Commented:
I found the reason I was getting the write errors and occasional file system corruption.

The external USB drive I was using was the new seagate 1.5TB drive.  This external drive has a "feature" that causes the drive to sleep if ti has no activity for 15 minutes.  http://www.seagate.com/www/en-us/products/external/freeagent/freeagent_desk/

I put an NTFS file system on the drive to be able to store files over 4GB in size.  When transferring a large file (18GB - 28GB) it sometimes took longer than the "sleep" interval and the drive shutdown causing the issue.  I was running the transfer at a low priority (high nice level) in order to decrease the impact on the system.

So I returned that new drive and purchased a generic USB case for a SATA drive and purchased a 1.5TB disk drive.  This drive does not have the previous enclosures "sleep feature" to cause these problems.

Thanks for all the assistance.
So the drive would go to sleep even when it was being used??!!  What a POS
jvosslerAuthor Commented:
Yes, according to the folks at seagate technical support. The "sleep interval" timing is triggered by something that initiates a file read or write.  Thus a long running write (or read) will allow the unit to think it should go to sleep.  If the unit sleeps while a write is in progress it has a good chance of corrupting the file system.

The support "back line storage engineer" I spoke with indicated that they did not anticipate anyone using NTFS.  When I asked about ext3, zfs, vxfs or ufs file systems he seemed to have no idea what those were and asked what version of windoz I was running.

I knew better than to pursue that line and thanked him for his time and information.
Oh man.  Not entirely sure whether to laugh or cry.  A shame that in this day and age a modern hard drive can be hamstrung by a ~20GB file.  I'm not even going to comment about drive "engineers" having no knowledge of filesystems, lol.  

At least you got it figured out.  Suppose that's all that really matters.  Cheers mate!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.