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

Joined
Jul 27, 2008
Messages
12
Reaction score
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?
 
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
 
Re: SD(HC) card as a part of the filesystem

mattylight said:
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.
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.

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?

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.
 
Re: SD(HC) card as a part of the filesystem

mattylight said:
I was wondering of you, if you do a proper shutdown every time do you still see the corruption of the SD card?

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.
 
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
 
Re: SD(HC) card as a part of the filesystem

larsll said:
.
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

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.
 
Re: SD(HC) card as a part of the filesystem

Has anyone got a clue on how to solve his?
 
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.
 
Re: SD(HC) card as a part of the filesystem

quindo said:
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.
Yep, that has to be it!

The aufs driver provides a unification file system for the Linux kernel. It allows to virtually merge the contents of several directories and/or stack them, so that apparent file changes in the aufs end in file changes in only one of the source directories.

Homepage: <http://aufs.sourceforge.net/>
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 ?
 
Re: SD(HC) card as a part of the filesystem

daymz said:
Have the issues with going to sleep and SD corruption been fixed ?

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..
 
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.
 
Re: SD(HC) card as a part of the filesystem

larsll said:
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.

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
 
Re: SD(HC) card as a part of the filesystem

jbesada said:
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

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...
 
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.
 
Re: SD(HC) card as a part of the filesystem

jbesada said:
Do I have to compile the whole kernel, or only a module or a set of modules? Which method for kernel compilation you used?
I think that you need to compile the whole kernel

jbesada said:
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?
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)
jbesada said:
Do you have a working set of kernel configuration files?

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.
 
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.
 
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 ...
 
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.
 
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
 
Back
Top