Author Topic: System Loses Access To Sd Card Files/dirs  (Read 5362 times)

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« on: December 08, 2006, 03:59:42 pm »
Hey all. On my C860 (boxer) with Cacko 1.23 I have my 1gb sd card formatted ext2. On the card I have pdaxqtrom, a swapfile & some other stuff symlink'd from the flash fs (/root/bin -> /mnt/card/bin, ...). All working ok (most of the time ...).

Problem is that I seem to lose the filesystem on the card once in a while. I haven't yet tracked down exactly when and/or why this happens, but for example, I try run a script that I've saved in /root/bin (which as i mentioned is actually a symlink to /mnt/card/bin) and it fails to find the script. I try to list the contents of /root/bin/ & I get an input-output error. The only way to get the card back seems to be to eject & then reinsert it.

I copied all of my stuff off of the card, ran fdisk & deleted then recreated the partition & then reformatted it with mkfs.ext2, but the problem still happens. Could this be a sign of a card going bad? Wouldn't that have shown up when I ran mkfs? The card works fine most of the time, and had no problems at all when I was running pdaxrom and Openzaurus.

Any ideas?
thanks
« Last Edit: December 08, 2006, 05:25:59 pm by grog »
GROG!

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #1 on: December 08, 2006, 04:35:37 pm »
Is really the file system going bad or is the card just unmounted?
(i.e.: what exactly do you mean by "losing the file system"? Do you lose it only from the running system, or from the card...)?

Does it happen on events such as suspend/resume only?

Does it happen while the card is inserted and under usage or does it only happen when the card is ejected and reinserted?

daniel
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #2 on: December 08, 2006, 04:46:46 pm »
You're right. I need to clarify. The card still shows as mounted and df still shows the proper space allocation, so saying it loses the filesytem is incorrect. And I believe it is only happening after a suspend/resume cycle, but the times it has happened I only noticed the next morning after I get home, turn it on & then plug it in to charge overnight. What I need to do is check it as soon as I resume.

Are there any known issues when the unit suspends (as in goes to sleep after the set period of inactivity) as apposed to being shut off (as in hitting the power button)? I'll have to spend time playing this weekend to determine when exactly it happens.
« Last Edit: December 08, 2006, 04:47:42 pm by grog »
GROG!

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #3 on: December 08, 2006, 04:49:05 pm »
Quote
Does it happen while the card is inserted and under usage or does it only happen when the card is ejected and reinserted?[div align=\"right\"][a href=\"index.php?act=findpost&pid=148560\"][{POST_SNAPBACK}][/a][/div]
It has never happened when the unit is in active use (i.e. when I've been working on it).
GROG!

dougeeebear

  • Hero Member
  • *****
  • Posts: 537
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #4 on: December 08, 2006, 05:13:50 pm »
This may be a little off-topic, but let me tell you my experience.

I have a 1GB Adata SD card formatted as ext2.

I was using Dosbox (without a swapfile activated, mind you).
I have Windoze 3.1 set up in Dosbox, and I was playing around with that.
All of a sudden I got a popup dialog that told me the memory was low and to reboot.
Not thinking it was a Windows dialog, I decided to do the reboot.
Well, it never rebooted so I had to pull the battery.
When I restarted my zaurus, my SD card was completely wiped out.
I also should note that I am using the SD card as the Dosbox Drive C mount.
So I think the combination of not having enough memory (not using the swapfile) and using the SD card as the Dosbox C mount was my big downfall.
I'm not sure if any of this info is relevant in your case, but I wanted to share my experience in case it might be helpful.

Regards,
Doug
« Last Edit: December 08, 2006, 05:14:30 pm by dougeeebear »
Zaurus SL-C1000 and SL-5500
NetWalker PC-T1 (tablet)

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #5 on: December 08, 2006, 05:24:53 pm »
Quote
This may be a little off-topic, but let me tell you my experience.[div align=\"right\"][a href=\"index.php?act=findpost&pid=148566\"][{POST_SNAPBACK}][/a][/div]
Thanks for sharing , but I don't think my situation is the same. My problem started before I installed pdaxqtrom & created the swapfile, so I'm sure it's not related. I just wanted to make sure the information about my current setup was complete.
GROG!

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #6 on: December 08, 2006, 05:27:41 pm »
I changed the topic title to (hopefully) better describe the problem.
GROG!

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #7 on: December 11, 2006, 12:51:09 pm »
After a little bit of testing I found that the problem always happens after a suspend/resume. And while I have several symlinks from /home/zaurus that point to directories on the root of my card (Documents, logs, mail, several others), and I have a swap file there as well, only the bin directory seems to be somehow 'lost' on resume.

Now is there something in the resume scripts that references a bin for any reason? Under the /etc/apm.d/resume.d there's only bluetooth & usb scripts, nothing about sd cards. I assume maybe /etc/sdcard or /etc/sdcontrol, but nothing there (that I can see) either.

For the mean time I've moved my bin directory under /home & symlink'd /root/bin there. I'd just prefer to have it on the card 'cause that's where I keep all my scripts & home-grown stuff, so prefer not to burn my internal flash with all my editing & updates.

thanks
GROG!

Drake01

  • Full Member
  • ***
  • Posts: 226
    • View Profile
System Loses Access To Sd Card Files/dirs
« Reply #8 on: December 11, 2006, 06:45:53 pm »
Quote
For the mean time I've moved my bin directory under /home & symlink'd /root/bin there. I'd just prefer to have it on the card 'cause that's where I keep all my scripts & home-grown stuff, so prefer not to burn my internal flash with all my editing & updates.

thanks
[div align=\"right\"][a href=\"index.php?act=findpost&pid=148844\"][{POST_SNAPBACK}][/a][/div]
What I do is keep a 'bin' directory on my card and add it to my PATH variable.  This works well for me.

Alternatively, you could put a little extra effort into this and mount all your "home-grown" files into /usr/bin by using the mount --bind command.  This command will allow you to mount individual files to another location, provided that a file of the same name exists in the destination directory.  So, you'd have to create mount points for each file that doesn't already exist in /usr/bin.  If the file already exists, I believe it will be replaced by the file being mounted over it, so this would also work for any customized versions of existing executables.  The original file still exists and can be "re-activated" by umounting the replacement file.

This second method would require a small script and seems to be more effort than it's probably worth, in my opinion.  I guess it all depends on what you're trying to accomplish.
Device: SL-C3200 running pdaXii13v2 build 5.5.0
Networking: Symbol Spectrum24 WLAN card; Kingston CIO10T CF NIC
Storage: 4GB Transcend 150x SD; 16GB Transcend 133x CF; 4GB Seagate CF HDD; 4GB Patriot SD
HID: Logitech V450 Laser Mouse; generic silicone USB keyboard; 2 generic optical mice; stock plastic stylus
GPS: generic "UT-41" USB GPS Receiver
Case: neoprene case from my old Palm foldable keyboard

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
System Loses Access To Sd Card Files/dirs
« Reply #9 on: December 11, 2006, 06:55:44 pm »
Quote
Quote
For the mean time I've moved my bin directory under /home & symlink'd /root/bin there. I'd just prefer to have it on the card 'cause that's where I keep all my scripts & home-grown stuff, so prefer not to burn my internal flash with all my editing & updates.

thanks
[div align=\"right\"][a href=\"index.php?act=findpost&pid=148844\"][{POST_SNAPBACK}][/a][/div]
What I do is keep a 'bin' directory on my card and add it to my PATH variable.  This works well for me.

Alternatively, you could put a little extra effort into this and mount all your "home-grown" files into /usr/bin by using the mount --bind command.  This command will allow you to mount individual files to another location, provided that a file of the same name exists in the destination directory.  So, you'd have to create mount points for each file that doesn't already exist in /usr/bin.  If the file already exists, I believe it will be replaced by the file being mounted over it, so this would also work for any customized versions of existing executables.  The original file still exists and can be "re-activated" by umounting the replacement file.

This second method would require a small script and seems to be more effort than it's probably worth, in my opinion.  I guess it all depends on what you're trying to accomplish.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=148877\"][{POST_SNAPBACK}][/a][/div]

like this?

for i in mycustombin1 mycustombin2 mycustombin3
do
  mount --bind /mnt/card/bin/$i /usr/bin/$i
done
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Drake01

  • Full Member
  • ***
  • Posts: 226
    • View Profile
System Loses Access To Sd Card Files/dirs
« Reply #10 on: December 11, 2006, 08:02:12 pm »
Quote
like this?

for i in mycustombin1 mycustombin2 mycustombin3
do
  mount --bind /mnt/card/bin/$i /usr/bin/$i
done
[div align=\"right\"][a href=\"index.php?act=findpost&pid=148878\"][{POST_SNAPBACK}][/a][/div]
Essentially.  However, it's a little uglier than I thought.  I was curious how this would work, so I wrote a script to try it.  If you run the mount command afterward, each individual file shows up separately.  I'm not sure if this would affect performance, but it creates a lot of noise if you want to see what you have mounted.  

I suppose I'll attach the script, in case anyone actually wants to play with this.  
Code: [Select]
#!/bin/bash
#
# testxxx.sh -- test script to mount files into an existing directory

SRC_DIR="/home/username/bin"
DEST_DIR="/home/username/bin2"

for ITEM in $SRC_DIR/*; do
#    Strip file path
    FILENAME=${ITEM##/*/}
    if ! [ -f $DEST_DIR/$FILENAME ]; then
  touch "$DEST_DIR/$FILENAME"
    fi
    mount --bind $SRC_DIR/$FILENAME $DEST_DIR/$FILENAME
done
Device: SL-C3200 running pdaXii13v2 build 5.5.0
Networking: Symbol Spectrum24 WLAN card; Kingston CIO10T CF NIC
Storage: 4GB Transcend 150x SD; 16GB Transcend 133x CF; 4GB Seagate CF HDD; 4GB Patriot SD
HID: Logitech V450 Laser Mouse; generic silicone USB keyboard; 2 generic optical mice; stock plastic stylus
GPS: generic "UT-41" USB GPS Receiver
Case: neoprene case from my old Palm foldable keyboard

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
System Loses Access To Sd Card Files/dirs
« Reply #11 on: December 12, 2006, 05:12:16 am »
I think that using unionfs would allow the whole thing to be much cleaner. In fact, it would also get rid of all the nasty sym-linking and allow the base file system to be nice and clean, and appear to be re-writable too.

You could then overlay the Z's internal flash for system files, in order to install patches etc, and then overlay the SD file system for stuff that changes a lot.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #12 on: December 12, 2006, 06:52:50 am »
A lot of great ideas guys. With my 100+ scripts I'd be leery about the mount overhead, but it'd be worth a try. Another strike against it is that I use the PATH to 'overload' some binary's, like my xmms script that does some stuff, loads /usr/bin/xmms, then does clean up. Since /root/bin is first in the PATH I can just call the script 'xmms' and don't have to change the startup icon.
thanks
GROG!

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
System Loses Access To Sd Card Files/dirs
« Reply #13 on: December 12, 2006, 09:25:08 am »
Quote
I use the PATH to 'overload' some binary's, like my xmms script that does some stuff, loads [div align=\"right\"][a href=\"index.php?act=findpost&pid=148912\"][{POST_SNAPBACK}][/a][/div]

I think it's a lot safer to use aliases than to do that, but that's just MHO.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

grog

  • Hero Member
  • *****
  • Posts: 692
    • View Profile
    • http://
System Loses Access To Sd Card Files/dirs
« Reply #14 on: December 12, 2006, 11:00:30 am »
Quote
Quote
I use the PATH to 'overload' some binary's, like my xmms script that does some stuff, loads [div align=\"right\"][a href=\"index.php?act=findpost&pid=148912\"][{POST_SNAPBACK}][/a][/div]
I think it's a lot safer to use aliases than to do that, but that's just MHO.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=148927\"][{POST_SNAPBACK}][/a][/div]
I'm not sure what you mean by 'safer', but 6/half-dozen it would seem, either way you're still redirecting what initially gets executed.

Thanks for the help (so far)
GROG!