You are not logged in.

#1 2010-04-29 23:38:58

earthpig
Member
Registered: 2009-03-24
Posts: 30

Am I being "lied to" about file copies to USB?

I know this is going to sound bizarre, but I think both pcmanfm and nautilus are misleading me.

Replicate:
1. copy/paste a large file (~700mb) from hard drive to thumb drive. watch the dialog box zip to 100% and close. play movie. it plays fine.

unmount thumb drive, remove, put back in. error messages when i try to play the file -- and sometimes it'll say the file is suddenly ~600 or ~650mb.

2. start over. copy/paste a large file (~700mb) from hard drive to thumb drive. watch the dialog box zip to 100% and close. play movie. it plays fine.

walk away, leaving thumb drive mounted and inserted for 20 minutes.

unmount and remove thumb drive. reinsert. play movie. it plays fine, no errors at all.


tried both 1 and 2 with two different usb ports, two different thumb drives, and a multitude of movies.


why does walking away for 20 minutes after it is "done" copying make a difference? any way i can get pcmanfm and/or nautilus to tell the truth about the progress?

Last edited by earthpig (2010-04-29 23:54:03)

Offline

#2 2010-04-29 23:52:28

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,384
Website

Re: Am I being "lied to" about file copies to USB?

How are you unmounting the thumb drive?   From what I understand, some of the transfer is stored in a cache to speed up the process from a user perspective.  But unmounting the drive should force all that to be written.

Offline

#3 2010-04-29 23:56:13

earthpig
Member
Registered: 2009-03-24
Posts: 30

Re: Am I being "lied to" about file copies to USB?

thanks for the response.

in both nautilus and pcmanfm (whichever i use to copy): right click on the drive on the left -> unmount -> wait till its done unmounting (both the indicator light on the thumb drive and the graphical indication in nautilus or pcmanfm) -> remove


some of the transfer is stored in a cache to speed up the process from a user perspective.

any way i can disable that? is that on arch's end, the hardware's end, or the thumb drive's end?

Last edited by earthpig (2010-04-29 23:57:24)

Offline

#4 2010-04-30 00:00:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Am I being "lied to" about file copies to USB?

Offline

#5 2010-04-30 00:00:40

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Am I being "lied to" about file copies to USB?

You can mount the drive with the 'sync' option. This will force all write operations to be done synchronously.

Offline

#6 2010-04-30 00:02:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Am I being "lied to" about file copies to USB?

[OT]
Ummm, it's the first time I've seen a 'tie' (check the post time: mine and falconindy's) on the forums. Does it mean I'll die tomorrow or sth?
[/OT]

Offline

#7 2010-04-30 00:04:20

earthpig
Member
Registered: 2009-03-24
Posts: 30

Re: Am I being "lied to" about file copies to USB?

sweet, thanks guys!

just to make sure i understand correctly:

1. i should start the copy process

2. wait till it claims to be done

3. run the command 'sync'

4. now unmount and remove

is that correct?

Offline

#8 2010-04-30 00:06:41

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: Am I being "lied to" about file copies to USB?

Hmm, is there any way we can edit Udev (?) to use "sync(hronous)" mount for external hdd/usb?

I've experienced the exact same thing, and it's highly frustrating.

Offline

#9 2010-04-30 00:11:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Am I being "lied to" about file copies to USB?

I don't use automounting and I have no file manager.

#!/bin/bash

DRIVE="/dev/sdb1"

if mount | grep -q $DRIVE; then
  umount $DRIVE
else
  mount $DRIVE /mnt/usb
fi

(I stole this piece of code, it's not mine)

I stick the stick in, run the script, copy / remove files and run it again - I physically remove the USB stick only after I see the prompt (and this can often take a while) ready after it finished unmounting - which means everything is synced.

Offline

#10 2010-04-30 01:32:53

eirik
Member
From: Oslo, Norway
Registered: 2009-01-22
Posts: 51

Re: Am I being "lied to" about file copies to USB?

earthpig wrote:

sweet, thanks guys!

just to make sure i understand correctly:

1. i should start the copy process

2. wait till it claims to be done

3. run the command 'sync'

4. now unmount and remove

is that correct?

No, you're supposed to use the sync option at mount time. Type "man mount" in a terminal.


Arch Linux x86_64 · xbmc-svn all night

Offline

#11 2010-04-30 01:37:46

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Am I being "lied to" about file copies to USB?

eirik wrote:
earthpig wrote:

sweet, thanks guys!

just to make sure i understand correctly:

1. i should start the copy process

2. wait till it claims to be done

3. run the command 'sync'

4. now unmount and remove

is that correct?

No, you're supposed to use the sync option at mount time. Type "man mount" in a terminal.

Yes, but - the 'sync' command will also flush caches to disk ...
In the 'old days' we always had to do "sync; sync; umount"

Offline

#12 2010-04-30 01:47:42

eirik
Member
From: Oslo, Norway
Registered: 2009-01-22
Posts: 51

Re: Am I being "lied to" about file copies to USB?

perbh wrote:
eirik wrote:
earthpig wrote:

sweet, thanks guys!

just to make sure i understand correctly:

1. i should start the copy process

2. wait till it claims to be done

3. run the command 'sync'

4. now unmount and remove

is that correct?

No, you're supposed to use the sync option at mount time. Type "man mount" in a terminal.

Yes, but - the 'sync' command will also flush caches to disk ...
In the 'old days' we always had to do "sync; sync; umount"

I stand corrected.

When copying files to my memory stick, the copying progress indicator goes to 100%, but keeps waiting there until the cache has been written completely. It's weird that the OP's system doesn't handle this properly, but I guess hardware differences are to blame.


Arch Linux x86_64 · xbmc-svn all night

Offline

#13 2010-04-30 02:08:21

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Am I being "lied to" about file copies to USB?

When your DE does an unmount, it takes quite a bit of time for syncing to properly finish if you've copied a large file. Using Gnome here, there's a big 'finishing copying files, do not remove yet' warning. If I wait for that to go away (and the activity light to shut off) then things are fine.

Its not really 'lying', caching of file writes is a Good Thing for preserving HD/thumbdrive lifespans and reducing power consumption.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#14 2010-04-30 02:13:42

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Am I being "lied to" about file copies to USB?

flamelab wrote:

Hmm, is there any way we can edit Udev (?) to use "sync(hronous)" mount for external hdd/usb?

I've experienced the exact same thing, and it's highly frustrating.

Sure. There's a few udev different flavors of udev rules in the wiki. I've modified one slightly, which looks like this...

KERNEL!="sd[e-z][0-9]", GOTO="media_by_label_only_auto_mount_end"

ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
ENV{ID_FS_LABEL}=="", GOTO="media_by_label_only_auto_mount_end"

ACTION=="add", RUN+="/bin/mkdir -p /media/$env{ID_FS_LABEL}"

# Global mount options
ACTION=="add", ENV{mount_options}="noatime,users"
# Filesystem specific options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},sync,utf8,uid=1000,gid=100,fmask=133,dmask=022"

ACTION=="add", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/$env{ID_FS_LABEL}"
ACTION=="remove", ENV{ID_FS_LABEL}=="?*", RUN+="/bin/umount -l /media/$env{ID_FS_LABEL}", RUN+="/bin/rmdir /media/$env{ID_FS_LABEL}"
LABEL="media_by_label_only_auto_mount_end"

Note that the first line probably needs to be modified -- I've been fighting something (dunno if its a bug) that makes this rule mount my internal drives at bootup -- fstab gets parsed, crying ensues because everything's already mounted, and I get dumped to a maintenance shell.

Offline

#15 2010-04-30 08:46:15

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: Am I being "lied to" about file copies to USB?

OP: can you reproduce this from the command line? I.e. do "mount; copy; unmount; mount;" and then check the big file.


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

#16 2010-04-30 20:12:35

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: Am I being "lied to" about file copies to USB?

karol wrote:

I don't use automounting and I have no file manager.

#!/bin/bash

DRIVE="/dev/sdb1"

if mount | grep -q $DRIVE; then
  umount $DRIVE
else
  mount $DRIVE /mnt/usb
fi

(I stole this piece of code, it's not mine)

I stick the stick in, run the script, copy / remove files and run it again - I physically remove the USB stick only after I see the prompt (and this can often take a while) ready after it finished unmounting - which means everything is synced.

You could always put that in your shell config file. That way, when you start a terminal, it will be mounted cool

Offline

#17 2010-04-30 22:47:10

earthpig
Member
Registered: 2009-03-24
Posts: 30

Re: Am I being "lied to" about file copies to USB?

eirik wrote:

When copying files to my memory stick, the copying progress indicator goes to 100%, but keeps waiting there until the cache has been written completely. It's weird that the OP's system doesn't handle this properly, but I guess hardware differences are to blame.

the most significantly unusual hardware i have is that i am typically copying things from an SSD to a thumb drive -- likely one of the more drastic speed differences.

OP: can you reproduce this from the command line? I.e. do "mount; copy; unmount; mount;" and then check the big file.

sure, i will later.

Offline

Board footer

Powered by FluxBB