Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: rsync + script + sd card

  1. #1
    Join Date
    Feb 2010
    Location
    nh,usa
    Posts
    157

    Default rsync + script + sd card

    OpenSuse V13.2 64

    The sd card reader in my car won't read all the mp3 files, so I have written a script

    Code:
     
    rsync --recursive --checksum --verbose   --progress  --stats --ignore-times --whole-file  --include='*.mp3'   --exclude='*.*'    --log-file='/home/david/Log.txt'   /home/david/Audio/Radio   /var/run/media/david/MIX
    to copy with checksum option, to insure the files are getting copied correctly.

    I get the following error

    Code:
    rsync: mkstemp "/var/run/media/david/MIX/Temp_Collection/CHH_33/.track04.mp3.p8ysK7" failed: Read-only file system (30)
    What causes the read-only file system error, there are 100's of files that get copied fine, but then the error occurs in the middle what appears to be a smooth process.

    Is the sd card bad? I recently reformatted it.

    Is the rsysnc destination directory for the sd card correct, using the mount point root /var/run/media/david (MIX is the name of the sd card)?

    What am I missing?

    Thank you.
    Regards,

    RIH5342

  2. #2

    Default Re: rsync + script + sd card

    Hi,

    Im not sure about

    Code:
    /var/run/media
    well

    Code:
    /run/media
    is what my file manager display as the address but probably not important.

    So is the sdcard locked for read only some has a switch in the sdcard itself. which file system is in the sdcard? Do you have write permission on the sdcard?
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,270

    Default Re: rsync + script + sd card

    Quote Originally Posted by rih5342 View Post
    What am I missing?
    What we are missing is your openSUSE version

    Check if your file system is indeed mount readonly (with the mount command).
    Thus btw will also be reported in your dmesg on connectiing the device.

    It could be that there is a hardware switch (like suggested above), but also that the devfice, most probably having a non-Linux file system on it, is not properly removed from a Windows system. In that case, re-copnnecting it to that Windows systems and then either do a "Save remove", or shut down that Windows system (no hibernation of any kind) should repair this.
    Henk van Velden

  4. #4
    Join Date
    Feb 2010
    Location
    nh,usa
    Posts
    157

    Default Re: rsync + script + sd card

    The very first line of my post is OpenSuse V13.2 64, to which I'll add that I'm using KDE.

    The lock slide on the sd card is unlocked.

    When running my script, many files get transferred and then the readonly file system message appears, and the files stop getting transferred.

    The file system is Fat32.

    Using partition, I find the sd card name is sdd, and using the mount command, there is no mention of sdd.

    Just now I safely unmounted the card then inserted it. A pop-up notification appears (lower right of desktop) offering 3 options,
    the first of which is dolphin, and for the first time EVER, I notice a little button, which when clicked, says mount.

    Repeating the mount command, sdd now appears with an ro.


    I've always wondered why OpenSUSE worked so poorly with thumb drives. When I insert an sd card, why does the pop-up appear,
    then disappear if you wait. Why does dolphin display the sd card's name, list all the files, directories etc, if it isn't mounted properly?

    This is great news, I'll repeat my rsync tests.

    Thank you.
    Regards,

    RIH5342

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,270

    Default Re: rsync + script + sd card

    Quote Originally Posted by rih5342 View Post
    The very first line of my post is OpenSuse V13.2 64, to which I'll add that I'm using KDE.
    Sorry about that. It seems that I am so used to "openSUSE 13.2" and the like that my brains skip upper/lower case variants of it automaticaly.
    Henk van Velden

  6. #6

    Default Re: rsync + script + sd card

    Quote Originally Posted by rih5342 View Post
    Repeating the mount command, sdd now appears with an ro.
    Maybe the filesystem is corrupted? This might also explain why it suddenly became read-only in the middle of the rsync (if a filesystem error is encountered, the filesystem gets remounted ro by default).
    Try to run "sudo dosfsck -r /dev/sdd1" (or whatever your device is) to repair it. You have to unmount it first though if it is mounted.

    I've always wondered why OpenSUSE worked so poorly with thumb drives.
    It works perfectly here, not "poorly" at all.

    When I insert an sd card, why does the pop-up appear,
    then disappear if you wait.
    Probably to notice you of the device and let you act upon it. If you don't want to, why should the popup stay in your way?

    Anyway, that popup is displayed by KDE's device notifier. If you don't like it, just disable it in the system tray settings.

    Why does dolphin display the sd card's name, list all the files, directories etc, if it isn't mounted properly?
    Dolphin mounts it if you click on the sd card on the left "Places" panel.
    Last edited by wolfi323; 14-Mar-2015 at 03:08.

  7. #7
    Join Date
    Feb 2010
    Location
    nh,usa
    Posts
    157

    Default Re: rsync + script + sd card

    First of all, I appreciate the efforts of OpenSuse.

    Second, my comment was from the perspective of, "... no wonder using thumb drives is so painful, it's mounted as read only".

    Third, why are some files getting copied to a read only file system? It's as if some files get copied before the read-only status propagates through the system.

    Fourth, right now, my rsync script is running smoothly, thank you for your patience.
    Regards,

    RIH5342

  8. #8

    Default Re: rsync + script + sd card

    Quote Originally Posted by rih5342 View Post
    Third, why are some files getting copied to a read only file system? It's as if some files get copied before the read-only status propagates through the system.
    The point is that it gets _re_mounted read-only when/as soon as an error occurs while accessing it.

    So it could have been mounted read-write, but during copying/writing to it a filesystem error was encountered and therefore it "suddenly" became read-only.

    Fourth, right now, my rsync script is running smoothly, thank you for your patience.
    Good to hear.
    Did you do the dosfsck?

  9. #9
    Join Date
    Feb 2010
    Location
    nh,usa
    Posts
    157

    Default Re: rsync + script + sd card

    My rsync script failed again.

    The background for this "project".

    The .mp3 player in my car is erratic and I susect the mp3s are getting corrupted.

    Under windows, I have reformatted and checked the file system of the sd card several times, which doesn't fix the readonly behavior.
    There were no errors reported, can an sd card have bad blocks?

    Prior to running dosfsck, I deleted all files and emptied the trash.

    Code:
    dosfsck  -avt /dev/sdd1
    fsck.fat 3.0.26 (2014-03-07)
    fsck.fat 3.0.26 (2014-03-07)
    Checking we can access the last sector of the filesystem
    Boot sector contents:
    System ID "MSDOS5.0"
    Media byte 0xf8 (hard disk)
           512 bytes per logical sector
         16384 bytes per cluster
            38 reserved sectors
    First FAT starts at byte 19456 (sector 38)
             2 FATs, 32 bit entries
       7827968 bytes per FAT (= 15289 sectors)
    Root directory start at cluster 2 (arbitrary size)
    Data area starts at byte 15675392 (sector 30616)
       1956931 data clusters (32062357504 bytes)
    63 sectors/track, 255 heads
          8192 hidden sectors
      62652416 sectors total
    /.Trash-1000
      Contains a free cluster (723670). Assuming EOF.
    Checking for bad clusters.
    Reclaiming unconnected clusters.
    Checking free cluster summary.
    Free cluster summary wrong (1956926 vs. really 1956930)
      Auto-correcting.
    Performing changes.
    /dev/sdd1: 2 files, 1/1956931 clusters

    Code:
      The point is that it gets _re_mounted read-only when/as soon as an error occurs while accessing it.
    This is true, if I insert the sd card, a command line mount says, read write, whether I explicitly mount it or not.
    After the failure of the script, a command line mount says, ro.

    What next?
    Regards,

    RIH5342

  10. #10

    Default Re: rsync + script + sd card

    Quote Originally Posted by rih5342 View Post
    The .mp3 player in my car is erratic and I susect the mp3s are getting corrupted.
    If the mp3 player is "erratic", it could also cause filesystem corruption I suppose.
    The only way to "fix" that then is to run fsck each time before you do the rsync, I guess.

    There were no errors reported, can an sd card have bad blocks?
    Of course. Although they have a different cause than on a "real" hard disk.

    Check the ouput of "dmesg|tail" directly after the rsync error, this should show you whether there are bad blocks.
    But if you do a full surface format in Windows, it should detect bad blocks.

    What next?
    No idea.
    Something like that can also be caused if you remove the card without properly unmounting it first. But this has already been mentioned anyway.
    Last edited by wolfi323; 16-Mar-2015 at 06:17.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •