USB write problem where read is OK

Asked by urih

Hi,

When I connect a USB external disk writing to it is not possible:

uri@uri-laptop:~>cp README /media/URI\'S\ DISK/PST/
cp: cannot create regular file `/media/URI\'S DISK/PST/README': Read-only file system

However copying from the USB is OK.

I looked a bit for solutions and installed pmount but no good.
I did not modify any file.

just as I verify this problem again, the problems looks a bit different:

suddnly the cp does work ( didnt do anything ) but now only the first file copy works and the others fail:
 dir PST contains 5 files:

uri@uri-laptop:~>cp -frp PST/ /media/URI\'S\ DISK/
cp: preserving times for `/media/URI\'S DISK/PST/backup 15 04 09.pst': Read-only file system
cp: cannot create regular file `/media/URI\'S DISK/PST/TI all 30 05 2009.pst': Read-only file system
cp: cannot create regular file `/media/URI\'S DISK/PST/outlook backup 27 04 09.pst': Read-only file system
cp: cannot create regular file `/media/URI\'S DISK/PST/z local flder.zip': Read-only file system
cp: cannot create regular file `/media/URI\'S DISK/PST/a0794638.pst': Read-only file system
cp: preserving times for `/media/URI\'S DISK/PST': Read-only file system

uri@uri-laptop:~>ls -l /media/URI\'S\ DISK/PST/*
-rwx------ 1 uri root 276317184 2009-06-21 03:36 /media/URI'S DISK/PST/backup 15 04 09.pst*

looks like after the first copy the USB goes to "Read-only file system" status.

sometime if I disconnects the USB and reconnect it the copying is always denied.

could someone please help me out?

thanks

Uri

Here is the output of commands that might be helpful:

sudo fdisk -l
cat /etc/fstab
ls -l /media*
dmesg | tail
mount
id

uri@uri-laptop:~>sudo fdisk -l
[sudo] password for uri:

Disk /dev/sda: 33.7 GB, 33732689920 bytes
255 heads, 63 sectors/track, 4101 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000591f3

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 3962 31824733+ 83 Linux
/dev/sda2 3963 4101 1116517+ 5 Extended
/dev/sda5 3963 4101 1116486 82 Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8f9c798a

   Device Boot Start End Blocks Id System
/dev/sdb1 1 9729 78148161 c W95 FAT32 (LBA)
uri@uri-laptop:~>cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda1 during installation
UUID=3937874c-5394-4807-a9d5-c69f6f00b17d / ext3 relatime,errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=63597962-5dfa-4b2e-988e-239ff11a3ee7 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
uri@uri-laptop:~>ls -l /media*
total 40
lrwxrwxrwx 1 root root 6 2009-06-13 16:10 cdrom -> cdrom0/
drwxr-xr-x 2 root root 4096 2009-06-13 16:10 cdrom0/
lrwxrwxrwx 1 root root 7 2009-06-13 16:10 floppy -> floppy0/
drwxr-xr-x 2 root root 4096 2009-06-13 16:10 floppy0/
drwx------ 12 uri root 32768 1969-12-31 19:00 URI'S DISK/
uri@uri-laptop:~>dmesg | tail
[ 20.837833] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[ 20.838980] NFSD: starting 90-second grace period
[ 22.909053] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 22.909067] Bluetooth: BNEP filters: protocol multicast
[ 22.941731] Bridge firewalling registered
[ 24.031520] Linux agpgart interface v0.103
[ 24.057421] [drm] Initialized drm 1.1.0 20060810
[ 24.153736] [drm] Initialized vboxvideo 1.0.0 20090303 on minor 0
[ 28.704056] eth0: link up, 100Mbps, full-duplex
[ 39.080199] eth0: no IPv6 routers present
uri@uri-laptop:~>mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
lrm on /lib/modules/2.6.28-11-generic/volatile type tmpfs (rw,mode=755)
securityfs on /sys/kernel/security type securityfs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/uri/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=uri)
/dev/sdb1 on /media/URI'S DISK type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
uri@uri-laptop:~>id
uid=1000(uri) gid=1000(uri) groups=4(adm),20(dialout),24(cdrom),46(plugdev),106(lpadmin),121(admin),122(sambashare),1000(uri)
uri@uri-laptop:~>

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
urih
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

you need to mount the system user writable. It is fat32 formatted which is useful.

/dev/sdb1 on /media/URI'S DISK type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)

I suggest you rename it to take the punctuation out of the name to make life a LOT easier.

Looking at the mounting it appears to be fully writable: uid=1000

http://www.hafenscher.net/wiki/index.php?page=Mount_USB_stick_read_and_writable_for_users

may help. Obviously you will need to change any guide to use /dev/sdb1 as that is the device name of the partition.

If you're feeling lazy you can use

sudo cp

to copy stuff but if you copy to your home directory then you will need to chown the file back to your username

Revision history for this message
urih (uhalperin) said :
#2

Hi,

unfortunatly this did not help.

USB name was changed to URIS_DISK

1. sudo did not manage to cp :
uri@uri-laptop:~>cp tmp1 /media/URIS_DISK/
cp: cannot create regular file `/media/URIS_DISK/tmp1': Read-only file system
uri@uri-laptop:~>sudocp tmp1 /media/URIS_DISK/
sudo sudoedit
uri@uri-laptop:~>sudo cp tmp1 /media/URIS_DISK/
cp: cannot create regular file `/media/URIS_DISK/tmp1': Read-only file system

2. if you confirm that the uid (1000) looks in order , the link explains to use:

mount /dev/sda1 /mnt/usbstick/ -o uid=1000

I used :
uri@uri-laptop:~>sudo mount /dev/sdb1 /media/URIS_DISK -o uid=1000
mount: special device /dev/sdb1 does not exist
uri@uri-laptop:~>

perhaps I lost you somewhere.

thanks

Uri

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

well it clearly does as your fdisk output states:

   Device Boot Start End Blocks Id System
/dev/sdb1 1 9729 78148161 c W95 FAT32 (LBA)

I'd reboot with the device disconected then plug it in after the bootup and you may get some luck.

if the device is mounted automagically then run:

sudo mkdir /media/URIS_DISK; sudo umount /dev/sdb1; sudo mount /dev/sdb1 /media/URIS_DISK -o uid=1000

Revision history for this message
urih (uhalperin) said :
#4

I suppose that by "well it clearly does" you mean tha I lost you - probably I did.

anyway just reboot did not help.

for the later suggestion it works !!!

there was a small problem on the way.
sudo mount /dev/sdb1 did not work:
uri@uri-laptop:~>sudo mount /dev/sdb1 /media/URIS_DISK -o uid=1000
mount: special device /dev/sdb1 does not exist

after I mounted the USB by right click on the icon on the lower right of the screen - I umounted it
and the issued the command:
sudo mount /dev/sdb1 /media/URIS_DISK -o uid=1000

I cant say I understand whats going on - but lets just settle with this joyfull fact.

perhaps you have a hint how to prevent this from happening or just automate it?

thanks

Uri

may I leave this open of another day or two just to make sure its working smoothly?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Sure, your call duder. Glad you got a resolve :D

Revision history for this message
urih (uhalperin) said :
#6

Hi,

the solution you gave me works fine.

I wish that in next releases this problem would disappear for other ubuntu folowers.

thanks alot for the advice.

Uri