hfsplus filesystem mounted R/O when dirty, not cleaned up

Bug #22535 reported by Adam Lydick
8
Affects Status Importance Assigned to Milestone
gnome-volume-manager (Ubuntu)
Invalid
Wishlist
Martin Pitt

Bug Description

I hotplugged my ipod nano. It was mounted ok, but the filesystem is flagged as
read-only, although mount reports it as rw.

lydickaw@rohan:~ $ cd /media/ipod/
lydickaw@rohan:/media/ipod $ ls
Calendars Contacts iPod_Control Notes
lydickaw@rohan:/media/ipod $ cd Notes/
lydickaw@rohan:/media/ipod/Notes $ ls -al
total 4
drwxr-xr-x 1 lydickaw lydickaw 3 2005-09-04 04:05 .
drwxr-xr-x 1 lydickaw lydickaw 15 2005-09-08 20:46 ..
-rw-r--r-- 1 lydickaw lydickaw 14 2005-09-04 04:05 Instructions
lydickaw@rohan:/media/ipod/Notes $ touch test.txt
touch: cannot touch `test.txt': Read-only file system
lydickaw@rohan:/media/ipod/Notes $ mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro,user_xattr)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /lib/modules/2.6.12-9-386/volatile type tmpfs (rw)
/dev/md0 on /var/storage type ext2 (rw)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sda3 on /media/ipod type hfsplus (rw,noexec,nosuid,nodev,uid=1000,gid=1000)
lydickaw@rohan:/media/ipod/Notes $

Revision history for this message
Seth Hasani (sepheebear) wrote :

This bug may be related to drive being unmounted uncleanly and the setting of
HFSPLUS_VOL_INCNSTNT bit. Possible workaround is to mount the drive using
hpmount from the hfsplus package in main. Another workaround is to run fsck on
the drive using fsck_hfs under Mac OS X. Here is a related thread:
http://lkml.org/lkml/2004/5/22/103

Revision history for this message
Adam Lydick (lydickaw) wrote :

Good catch, fsck_hfs from my osx machine followed by a clean unmount resolved
the problem.

I'm pretty sloppy about properly unmounting hotplugged devices (on both linux
and osx), so it's entirely possible that a dirty unmount caused the problem.

The question is what the right solution is, since I'm pretty sure I'm not the
only one to ignore "don't unplug me yet" messages ;)

Revision history for this message
Ben Collins (ben-collins) wrote :

Well, pretty much the correct solution is to not do that :)

Really, there's nothing we can do to stop people from unplugging a device that
shouldn't be unplugged.

Revision history for this message
Adam Lydick (lydickaw) wrote :

I think the current behavior is going to be pretty confusing. Enforcing the
dirty flag makes sense, but an "impolite" unplug is probably going to happen at
some point. OSX recovers from this silently -- shouldn't ubuntu try to do the same?

Even if all users follow the recommended steps (unmount before unplugging),
imagine this scenario:
 * I leave my ipod plugged in over the weekend while I'm away.
 * The power goes out with the drive marked dirty.
 * I'm stuck with a R/O device until I figure out what happened.

What would be really nice (feature enhancement) is:
* Hotplug a dirty FS.
* mount it readonly.
* notify the user that it was improperly unmounted and explain how to do it right.
* run hfsmount to clear the flag (or fsck_hfs, if it exists for linux)
* remount r/w

A quick workaround:
* Detect the dirty fs
* Mount it readonly
* Pop up an explaination of *why* the volume is r/o and the workaround to fix it.

Yet another option:
* Mount hotpluggable devices with the synchronous write flag to disable caching
and reduce the chance of data loss. This probably has performance consequences
for less frequently accessed devices (such as an external HD).

Revision history for this message
Ben Collins (ben-collins) wrote :

Wouldn't the correct thing be to use hfsmount to mount the filesystem to begin
with? Either way, sending this to hotplug.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

udev

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

udev just handles loading the modules and making the block device, it's up to
hal onwards to actually mount them

Revision history for this message
Martin Pitt (pitti) wrote :

This is a special case of the more generic bug 28622, thus I'm closing this as duplicate.

Changed in gnome-volume-manager:
status: Confirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.