Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Cannot open/copy a 50.0 mb file on USB memory.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
optiluca
Guru
Guru


Joined: 16 Jan 2006
Posts: 551
Location: Rivergaro, Italy

PostPosted: Sat Jun 20, 2009 9:41 pm    Post subject: [solved] Cannot open/copy a 50.0 mb file on USB memory. Reply with quote

Hi. Today I transferred a whole load of photos/videos from my FAT formatted camera to my laptop, and everything went just fine, except for the largest file present, at 50.0 mb. This file refused to copy under dolphin so I tried in a console and got

Code:
cp -v /media/disk/DCIM/100_PANA/P1000837.MOV /home/luca/
`/media/disk/DCIM/100_PANA/P1000837.MOV' -> `/home/luca/P1000837.MOV'
cp: reading `/media/disk/DCIM/100_PANA/P1000837.MOV': Input/output error


And the following error appeared in dmesg

Code:
[ 8365.456896] attempt to access beyond end of device
[ 8365.456903] sdb1: rw=0, want=7736320, limit=7736319
[ 8365.457222] attempt to access beyond end of device
[ 8365.457226] sdb1: rw=0, want=7736320, limit=7736319


All smaller files worked just fine.. :? Any ideas?

Thanks in advance :)
_________________
# "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"

http://www.rinkworks.com/stupid/cs_mincing.shtml


Last edited by optiluca on Mon Jun 22, 2009 10:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
deathcon1
Apprentice
Apprentice


Joined: 30 Aug 2007
Posts: 182
Location: Canada

PostPosted: Sun Jun 21, 2009 2:07 am    Post subject: Reply with quote

You're trying to read from an address past the end of the partition.

Post the output of
Code:
fdisk -l <PATH TO MEMORY CARD>
Back to top
View user's profile Send private message
optiluca
Guru
Guru


Joined: 16 Jan 2006
Posts: 551
Location: Rivergaro, Italy

PostPosted: Sun Jun 21, 2009 7:42 am    Post subject: Reply with quote

deathcon1 wrote:
You're trying to read from an address past the end of the partition.

Post the output of
Code:
fdisk -l <PATH TO MEMORY CARD>


This is not the last video/picture i took though, and all the following ones were just fine :?

Anyway..

Code:
fdisk -l /dev/sdb

Disk /dev/sdb: 3965 MB, 3965189632 bytes
49 heads, 48 sectors/track, 3292 cylinders
Units = cylinders of 2352 * 512 = 1204224 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               4        3293     3868160    b  W95 FAT32


BTW, in case it helps..

Quote:
emerge --info
Portage 2.2_rc33 (default/linux/amd64/2008.0/desktop, gcc-4.3.3, glibc-2.10.1-r0, 2.6.30-gentoo-r1 x86_64)
=================================================================
System uname: Linux-2.6.30-gentoo-r1-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T6400_@_2.00GHz-with-gentoo-2.0.1
Timestamp of tree: Sat, 20 Jun 2009 07:30:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [enabled]
ccache version 2.4 [enabled]
app-shells/bash: 4.0_p24
dev-java/java-config: 2.1.8-r1
dev-lang/python: 2.6.2-r1
dev-util/ccache: 2.4-r8
dev-util/cmake: 2.6.4
sys-apps/baselayout: 2.0.1
sys-apps/openrc: 0.4.3-r3
sys-apps/sandbox: 2.0
sys-devel/autoconf: 2.13, 2.63-r1
sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils: 2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool: 2.2.6a
virtual/os-headers: 2.6.29
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mtune=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=core2 -mtune=core2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distcc distlocks fixpackages getbinpkg parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://192.168.0.102/ http://mirror.cambrium.nl/pub/os/linux/gentoo/ http://mirror.jamit.de/gentoo/ ftp://mirror.switch.ch/mirror/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en_GB it"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/kde-testing /usr/local/portage/layman/mpd /usr/local/portage"
SYNC="rsync://192.168.0.102/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 amr apm avi bash-completion berkdb bluetooth branding bzip2 cairo caps cdaudio cddb cdr ch chm cli consolekit cracklib crypt css cups dbus dhcp dri dts dv dvb dvd dvdr dvdread editor emboss emovix encode evo fam fame fbcondecor ffmpeg firefox flac foomaticdb fortran gcj gd gdbm gif git glitz glx gphoto2 gpm hal iconv id3tag ieee1394 imagemagick inotify ipod ipv6 isdnlog it jack java java6 joystick jpeg kde kickoff ladspa ldap libnotify libsamplerate lm_sensors mad mbrola midi mikmod mmx mp2 mp3 mp4 mpeg msn mudflap multilib musicbrainz ncurses networkmanager nls nptl nptlonly nsplugin nvidia ogg opengl openmp pam pcre pdf perl pmu png ppds pppd python qt qt3 qt3support qt4 quicktime readline reflection rtc samba scanner sdl semantic-desktop session slp smp snmp spell spl sse sse2 ssl ssse3 startup-notification subtitles subversion svg sysfs tcpd threads tiff truetype twolame unicode usb v4l v4l2 vorbis wifi x264 xcb xcomposite xine xml xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard synaptics alps mouse evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB it" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

_________________
# "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"

http://www.rinkworks.com/stupid/cs_mincing.shtml
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Sun Jun 21, 2009 1:03 pm    Post subject: Reply with quote

it could be an issue with the FAT tables, these things happens (crappy vfat)
but I could be wrong.

I'd suggest to dump the USB disk to a file with dd
then try to mount it, see if the error is still there and then try touse fsck.vfat from the dosfstools to check the fs.

Hope someone's something else to say about it :?
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9886
Location: almost Mile High in the USA

PostPosted: Sun Jun 21, 2009 1:45 pm    Post subject: Reply with quote

optiluca wrote:

Code:
fdisk -l /dev/sdb

Disk /dev/sdb: 3965 MB, 3965189632 bytes
49 heads, 48 sectors/track, 3292 cylinders
Units = cylinders of 2352 * 512 = 1204224 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               4        3293     3868160    b  W95 FAT32



Oops, 3292 cylinders and end at 3293?

Can the device that wrote the card read the file back, itself?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
deathcon1
Apprentice
Apprentice


Joined: 30 Aug 2007
Posts: 182
Location: Canada

PostPosted: Sun Jun 21, 2009 2:28 pm    Post subject: Reply with quote

I think Peach is right - something's probably corrupted. Use DD to get an image of the drive then run the FAT file system check on the drive and try again. This way if the file system check blows up you can still extract the images from the dd file.

Code:
dd if=/dev/[USB DRIVE] of=~/usb_image.dd

Make sure you get the entire drive, not just a partition. I.E. if the drive is located at /dev/sdb1 run it on /dev/sdb so you don't capture just one partition.

Ok, now that you have the image, proceed with the file system check then try copying off the drive. [/code]
Back to top
View user's profile Send private message
optiluca
Guru
Guru


Joined: 16 Jan 2006
Posts: 551
Location: Rivergaro, Italy

PostPosted: Mon Jun 22, 2009 8:43 pm    Post subject: Reply with quote

Ok so I made the image of the memory card, but fsck.vfat run as root user is throwing interesting errors at me...

Code:
fsck.vfat -av /dev/sdb1
dosfsck 3.0.2 (28 Feb 2009)
dosfsck 3.0.2, 28 Feb 2009, FAT32, LFN
open /dev/sdb:Read-only file system


Code:
fsck.vfat -v /dev/sdb1       
dosfsck 3.0.2 (28 Feb 2009)                               
dosfsck 3.0.2, 28 Feb 2009, FAT32, LFN                     
Checking we can access the last sector of the filesystem   
Boot sector contents:                                     
System ID "        "                                       
Media byte 0xf8 (hard disk)                               
       512 bytes per logical sector                       
     32768 bytes per cluster                               
      6304 reserved sectors
First FAT starts at byte 3227648 (sector 6304)
         2 FATs, 32 bit entries
    483328 bytes per FAT (= 944 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 4194304 (sector 8192)
    120752 data clusters (3956801536 bytes)
63 sectors/track, 128 heads
      8192 hidden sectors
   7736320 sectors total
Checking for unused clusters.
Checking free cluster summary.
Free cluster summary wrong (4294967295 vs. really 22390)
1) Correct
2) Don't correct
? 1
Leaving file system unchanged.
/dev/sdb1: 409 files, 98362/120752 clusters


And this is as root user??

Am I doing anything blatantly wrong?

Thanks to all :)
_________________
# "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"

http://www.rinkworks.com/stupid/cs_mincing.shtml
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Mon Jun 22, 2009 9:11 pm    Post subject: Reply with quote

I'd really suggest you to work on the image file, instead of the physical USB.

create the image:
Code:
# dd if=/dev/sdb of=/path/to/usb.img

(as deathcon1 already told you)
mount the image created with dd
Code:
# mount -o loop /path/to/usb.img /mnt/disk

then try to access the files and see if everything still's giving errors, if so, go on and start fsck.vfat on the img file, try to recover the errors and if everything is going ok, reformat the USB disk (maybe from inside the camera).
Code:
# fsck.vfat -v /path/to/usb.img

If instead you cannot recover the error we should try to find out what the error is.

I repeat, don't touch the physical disk: you can mess with the image, but at least you always have the source.

I wouldn't mind the RO flag on the mounted USB at this point.

I'll wait for your next post :) keep going.
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
optiluca
Guru
Guru


Joined: 16 Jan 2006
Posts: 551
Location: Rivergaro, Italy

PostPosted: Mon Jun 22, 2009 9:16 pm    Post subject: Reply with quote

Code:
mount -o loop /home/luca/usb_image.dd /mnt/disk/
mount: you must specify the filesystem type


:?

Thanks for your prompt reply btw :)
_________________
# "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"

http://www.rinkworks.com/stupid/cs_mincing.shtml
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Mon Jun 22, 2009 9:58 pm    Post subject: Reply with quote

optiluca wrote:
Code:
mount -o loop /home/luca/usb_image.dd /mnt/disk/
mount: you must specify the filesystem type


:?

Thanks for your prompt reply btw :)

you're right
since you dd the entire disk instead of the whole partition, you need to specify the offset for the partition to be mounted (infact you can only mount partitions with mount, and not "disks")
for this to work we need to calculate the offset for the partition
first use fdisk with -u to have a unit size of sectors (should be 512b unit) instead of cylinders:
for example:
Code:
# fdisk -lu /dev/sdb

Disco /dev/sdb: 8317 MB, 8317304832 byte
64 testine, 32 settori/tracce, 7932 cilindri, totale 16244736 settori
Unità = settori di 1 * 512 = 512 byte
Identificativo disco: 0x69737369

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sdb1              32    16244735     8122352    7  HPFS/NTFS


you should see where the start is (32) and multiply it by 512 (= 16384 bytes)
now you can mount it correctly with:
Code:
# mount -o loop,offset=16384 /path/to/img /mnt/disk


that's it
sorry if this might be a bit sophisticated, but that's the clean way.
:)
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
optiluca
Guru
Guru


Joined: 16 Jan 2006
Posts: 551
Location: Rivergaro, Italy

PostPosted: Mon Jun 22, 2009 10:14 pm    Post subject: Reply with quote

The copy works successfully from the image file :D Thank you very much :) Could you give me an explanation as to why the hell the file from the card doesn't work and the same file on what should be a perfect copy of the card does?? In any case, should I expect this to happen again? :?

Grazie mille :)
_________________
# "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"

http://www.rinkworks.com/stupid/cs_mincing.shtml
Back to top
View user's profile Send private message
Peach
Advocate
Advocate


Joined: 08 Mar 2003
Posts: 3686
Location: London, UK

PostPosted: Mon Jun 22, 2009 10:39 pm    Post subject: Reply with quote

optiluca wrote:
The copy works successfully from the image file :D Thank you very much :) Could you give me an explanation as to why the hell the file from the card doesn't work and the same file on what should be a perfect copy of the card does?? In any case, should I expect this to happen again? :?

That's great.
Why? Nice question. VFAT filesystems are a bad beast (read: "shortname" default option hell, no atime and ctime, no real perms, and so on), so actually the problem could lie on a a bad partition descriptor, or even on a bad FAT table entry, but I'm not that sure about the latter.

I don't think the problem could lie on the hardware, since you could have had problems even reading with dd.
Anyway I strongly suggest you to re-format carefully the disk to avoid any future errors on it.

optiluca wrote:
Grazie mille :)

Figurati ;)
_________________
Gentoo user since 2004.
"It's all fun and games, until someone loses an eye" - mom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum