[SOLVED] SD(HC) card as a part of the filesystem

Discussion in 'Linux' started by zzats, Jul 28, 2008.

  1. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    Problem: SDHC partition table corruption after suspend/resume

    Solution: a Kernel compiled with CONFIG_MMC_UNSAFE_RESUME enabled.


    Hi all,

    I tried toying around with a quick SDHC card, and the original idea was to mount it as my home directory. The idea seemed a brilliant one, as it practically removed all the waitings involved with heavy firefox-caching or downloading large files, so the basic idea of "halving" the SSD-workload proved to work nicely, the overall responsiveness and speed of the system rose significantly. (if anyone has a good idea of how to benchmark these, let me know and I'm willing to try)

    ...but it was too good to be true. The problems arose when I first suspend my laptop, the ext2 system on the SD-card is getting corrupted due to unclean unmounts and the card reader device resetting itself (hint: partition table corrupts)

    I tried some solutions, that I thought were potential ones. Had the reader been an USB-device, this is exactly what USB_PERSIST would have solved, but that doesn't help with PCIE-devices, obviously.

    I tried also adding the sdhci, mmc_block and mmc_core modules to acpi whitelist, no luck -> the home partition cannot be unmounted for reasons unknown to me, and the laptop doesn't suspend at all.

    Has anyone else tried to mount vital parts of the system, such as the root partition to an SD card and has managed to get the machine actually working this way? If so, could we try writing a small howto on the subject?
     
    zzats, Jul 28, 2008
    #1
  2. zzats

    mattylight

    Joined:
    Jul 17, 2008
    Messages:
    15
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    I have been messing around with the same general idea in Ubuntu, and had the same results. I was just switching back to linpus to see if I would have better luck back here in this OS. I wanted to have all of my music stored on the SD card, and just allow the computer to read that as the music folder. But after suspend/hibernate the card got corrupted. I was wondering of you, if you do a proper shutdown every time do you still see the corruption of the SD card? If I were to use an external usb hd would the problems be the same?
    Matt
     
    mattylight, Jul 28, 2008
    #2
  3. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    That's an easy case!

    The corruption can be solved by doing a fairly simple script that should 1) Determine which programs are trying to access the music folder during suspend process (by using lsof & various other commands) 2) Kill them 3) Unmount the music folder, maybe by -f(orce), and during recovering from suspend, just a simple mounting of the SD-card.

    No. the problems would not be the same. The default Ubuntu 8.04 kernel supports USB_PERSIST, which is basically the solution. You need to enable it for the devices manually, someone on the Eee-forum had a nice script doing this, even if the card magically changed the USB-slot it's assigned to. By enabling USB_PERSIST, the kernel ignores the reset of USB-controllers during suspend, and, if the USB-slot has not changed for the USB-disk during suspend, just assumes the device is in the same state as it was when the suspend started -> no corruption.

    You can try it out with, for example:
    Code:
    cat /sys/bus/usb/devices/5-5/devices
    Which for me, gives:
    BUFFALO INC. USB-SATA Bridge
    ...my USB-drive, and to enable USB_PERSIST:
    Code:
    sudo -s
    echo 1 > /sys/bus/usb/devices/5-5/devices/power/persist
    ...Which basically solves the scenario you described.

    Hope this helps, even a bit.
     
    zzats, Jul 28, 2008
    #3
  4. zzats

    Thomas8675309

    Joined:
    Jul 18, 2008
    Messages:
    31
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    I have the suspend/hibernate problem in Ubuntu, but I have experienced no SD partition corruption problems when I do proper shutdowns. So my temporary, but non-ideal, solution is not to use hibernate or suspend.
     
    Thomas8675309, Jul 28, 2008
    #4
  5. zzats

    larsll

    Joined:
    Jul 26, 2008
    Messages:
    19
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    mattylight: If you only want to have a standard "basic" music folder on your SD card I would suggest formatting it as FAT32. Apparently it is not affected as it does not keep track of clean unmounts and other such fancy features. You will loose symlinking and UNIX style permission management, but for music it might be acceptable.

    zzats: Did you try the SDHC hard drive extension in Linpus? How does it do it? (Mine is already re-installed with Ubuntu, so no way to check...) I suspect that they have some fancy options somewhere...

    Some hints for solving related issues for Eee PC:
    http://forum.eeeuser.com/viewtopic.php? ... 38#p141638
     
    larsll, Jul 28, 2008
    #5
  6. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    Yes I actually tried it today at work. the SDHC extension works fine during suspends and resumes, I logged the dmesg outputs and various logs, but I just couldn't find anything I could take note of. I also went through Linpus' suspend scripts, but couldn't really make anything out of them.

    Does anyone happen to have a Linpus computer close by, and could make a tarball of the entire /etc directory? The solution might lie there, or in a specially patched SD-reader driver...

    The Eee unforunatelly uses an USB-reader, so I assume the solutions are invalid for the one.
     
    zzats, Jul 29, 2008
    #6
  7. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    Has anyone got a clue on how to solve his?
     
    zzats, Aug 1, 2008
    #7
  8. zzats

    sroppon

    Joined:
    Aug 3, 2008
    Messages:
    1
    Likes Received:
    0
    sroppon, Aug 3, 2008
    #8
  9. zzats

    quindo

    Joined:
    Aug 5, 2008
    Messages:
    29
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    Don't know if this will help but I've found that acer uses the aufs (like unionfs but different).
    I think linpus uses this to extend the 8gb drive with the sd(hc) card found in the left cardreader.
     
    quindo, Aug 5, 2008
    #9
  10. zzats

    daymz

    Joined:
    Jul 28, 2008
    Messages:
    44
    Likes Received:
    0
    Location:
    Montreal, QC, Canada
    Re: SD(HC) card as a part of the filesystem

    Yep, that has to be it!

    Plus, it seems as if there is a package for Ubuntu as well.

    Have the issues with going to sleep and SD corruption been fixed ?
     
    daymz, Aug 5, 2008
    #10
  11. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    No. The problem still very much exists.

    I haven't had the energy to try around with aufs, I hope to hear some reports on it. I'm just afraid it's not the correct solution, I mean, with the results I'm hoping to see..
     
    zzats, Aug 5, 2008
    #11
  12. zzats

    larsll

    Joined:
    Jul 26, 2008
    Messages:
    19
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    Looking at the Linpus kernel config; the solution seems to be to have the following in the config:
    Code:
    CONFIG_MMC_UNSAFE_RESUME=y
    This is the MMC equivalent of USB_PERSIST, so danger danger, do not take the card out during a suspend. Might be a good idea to add sync to the mount point.

    Compiling a custom kernel now to check what happens.
     
    larsll, Aug 23, 2008
    #12
  13. zzats

    jbesada

    Joined:
    Aug 18, 2008
    Messages:
    25
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    So, what happened? Did it work? I have never tried to create a custom kernel, but this is important enough to try. My system is almost perfect for my uses now. If I were able to suspend I would need nothing else
     
    jbesada, Aug 25, 2008
    #13
  14. zzats

    larsll

    Joined:
    Jul 26, 2008
    Messages:
    19
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    Yes, it seems to do the job. The suspend script anyways run a sync before turning off electricity, so it is safe.

    Another tweak necessary was to set the last number (fsck pass number) in fstab to 0 to turn of boot-time fsck of the card. My problem was that checkfs wanted to check /dev/mmcblk0, which is the raw device, and not /dev/mmcblk0p1, which is my partition...
     
    larsll, Aug 25, 2008
    #14
  15. zzats

    jbesada

    Joined:
    Aug 18, 2008
    Messages:
    25
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    I have been searching for information regarding kernel compilation, and it seems too complicated.

    Do I have to compile the whole kernel, or only a module or a set of modules? Which method for kernel compilation you used?

    Do I have to do the compilation in the AA1 computer, or I could do it in my other much more powerful laptop and copy the resulting packages?

    Do you have a working set of kernel configuration files?

    Thanks in advance for your help.
     
    jbesada, Aug 26, 2008
    #15
  16. zzats

    quindo

    Joined:
    Aug 5, 2008
    Messages:
    29
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    I think that you need to compile the whole kernel

    Since the Atom is x86/ia32 you can compile it on your laptop (IF you laptop is x86 en runnning a 32bit OS).
    I would recommend downloading the Fedora 8 iso and run that inside a Virtual machine (virtualbox recommended ;-) )
    That way you'll have almost exactly the same environment as on the AA1.
    (http://download.fedoraproject.org/pub/f ... 86-DVD.iso)
    Look in the /boot directory of your AA1.
    Most likely there is a config there.
    Or else in the /boot directory of the Fedora 8 distribution :)

    Good luck.
     
    quindo, Aug 26, 2008
    #16
  17. zzats

    jbesada

    Joined:
    Aug 18, 2008
    Messages:
    25
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    thank you for your help.

    I am using stock Ubuntu kernel, not linpus,
    I will continue my research.
     
    jbesada, Aug 26, 2008
    #17
  18. zzats

    jbesada

    Joined:
    Aug 18, 2008
    Messages:
    25
    Likes Received:
    0
    Re: SD(HC) card as a part of the filesystem

    It works!

    I used the "old debian" method, and everything is correct now.

    compiling alsa, and preparing to get webcam support again in the next few hours ...
     
    jbesada, Aug 30, 2008
    #18
  19. zzats

    zzats

    Joined:
    Jul 27, 2008
    Messages:
    12
    Likes Received:
    0
    the CONFIG_MMC_UNSAFE_RESUME seems to solve the entire problem nicely. Been trying a few suspends with ext2, and it seems to work as hoped.
     
    zzats, Sep 9, 2008
    #19
  20. zzats

    jeffmings

    Joined:
    Sep 12, 2008
    Messages:
    4
    Likes Received:
    0
    What would be _great_ is if someone could make a slightly modified Ubuntu Acer One kernel available. Just by setting CONFIG_MMC_UNSAFE_RESUME and compiling in the MadWiFi driver, someone could make it much simpler to run 8.04.1 on the A1.

    Any top notch Linux geeks up to the challenge?

    Aloha,

    -Jeff Mings
     
    jeffmings, Sep 15, 2008
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.