Secure Digital card: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Add instructions for formatting ext2)
No edit summary
Line 101: Line 101:
== Formatting and using with ext2 ==
== Formatting and using with ext2 ==


I moved the discussion of this to 'Talk'. I am having problems with the partition table disappearing. When this is more stable it can be moved back here.
FAT 16 and 32 are very portable formats, and have advantages when used as an 'exchange' device. However, they have major issues when they are used as an extension to the Linux file system, because they do not support symbolic links. As a result many installs break when transferred to a FAT formatted SD card, because symbolic links are lost. On the XO, the SD card is recommended as a semi-permanent mount, as an extension of the file system. The card slot is not meant for exchange device use. Therefor, formatting a SD card with a fully Linux compatible file system has advantages.
[[User:Rmyers|Rmyers]] 12:29, 18 February 2008 (EST)

The following are instructions on how to format a SD card with the Linux ext2 file system, so that it can be used as a full featured extension to the base flash file system.

=== Back up anything you don't want to lose from the card. ===

=== Change the partition, and format it ===

su
umount /dev/mmcblk0p1
/sbin/ fdisk /dev/mmcblk0
(inside fdisk type the following commands)
d (delete old partition)
n (create new)
p (primary)
1 (partition number)
<return> (default first cylinder)
<return> (default last cylinder)
t (partition type)
83 (Linux)
w (write and exit)
/sbin/mkfs.ext2 -L YOURLABEL /dev/mmcblk0p1
=== Shutdown and restart your XO, to mount the changed partition ===
=== Transfer and link stuff from the XO flash to the card. ===

Here's a simple script for copying a diectory using tar:

cd to the source directory
replace <target> with your target directory
tar cf - . | (cd <target>; tar --same-owner xvkp -)

As a suggestion, set up the SD file tree as a sparse copy of the Flash. That is, if OpenOffice lives at /opt/OpenOffice.org2.3, make a directory on the SD /opt/OpenOffice.org2.3, copy, remove the original, replacing it with a link to the copy on the card.

Here's an example to move OpenOffice to the card:

su -l
mkdir /media/int2gsd/opt (int2gsd is the name of the the card, substitute your name)
mkdir /media/int2gsd/opt/openoffice.org2.3
cd /opt/openoffice.org2.3
tar cf - . | (cd /media/opt/openoffice.org2.3; tar --same-owner xvkp -)
rm -r /opt/openoffice.org2.3
ln -s /media/opt/openoffice.org2.3 /opt/openoffice.org2.3
exit

=== Use it ===

I was able to transfer some "first world" applications (like OpenOffice) off the XO flash to the SD card, and establish symbolic links from their old locations to their location on the card. Everything seems ok at this time.

One consequence is that the card is no longer recognized by Sugar as a Journal repository.

[[User:Rmyers|Rmyers]] 10:44, 15 February 2008 (EST)


==Wikipedia==
==Wikipedia==

Revision as of 17:29, 18 February 2008

This article is a stub. You can help the OLPC project by expanding it.

The XO laptop has 1 MMC/SD/SDHC slot. SD cards and USB flash drives are automatically mounted in the Journal Activity. The Journal entry shows you how to access the add-on memory devices. This is intermittent in the first release.

You can move files to and from the storage media by dragging and dropping the file in the Journal view to the USB stick icon at the bottom of the screen or by command line in the Terminal Activity. See discussion Talk:Secure_Digital_card to talk about your situation.

Use

  1. insert card (noted below)
  2. device will show up in journal if correctly mounted. an error message may briefly flash when booting if it didn't work, but other than that you can do a "df" or "cat /etc/mtab" or "cat /etc/fstab" to see what's up
  3. to safely remove the device, click on it in the journal (lower left side most likely), and choose unmount.
if it's currently in use, this will happen :???

Supported cards

  • FAT16, FAT32 formatted
  • Reduced Size MMC cards, like the ones Nokia uses in Nokia 770 work well.
  • No word on straight old MMC cards—even though they should work, some other hardware doesn't let it work.

Implementation

XO uses a custom microchip for SD card access, Camera and Flash Enabler, or CaFE. CaFE includes SDHC support. SDHC is compatible at a hardware level with SD. Pierre Ossman wrote the Linux driver support for SDHC. SD cards up to something like 256 GB should be supported. cafe is driven by the sdhci driver. cafe follows the standard host controller interface for SD controllers.

SD standard

Here is how SD block addressing works: The address is 32 bits. In the CaFe chip, which is compatible with the standard "SDHCI" spec, the address goes in the 32-bit chip register at offset 8. For old SD cards (not the new SDHC - High Capacity cards), the address is a byte address, so the maximum size is 4 Gbytes. For the newer SDHC cards, the address is a block number, assuming 512 byte blocks, so the maximum size is 2 TBytes. None of this is CaFe-specific, BTW. It is standard SD. In other words, SDHC just shifts the addresses by nine bits, allowing an effective 40 bit address. The other limit that's often written about, 32GB, is an artificial limit in Window's FAT formatter; Windows will use the generally incompatible NTFS instead. Linux can format FAT up to the ~300GB real limit just fine, after that we'll need to use a linux specific fs.

Exceptions

When they don't mount

I Installed (2) different USB sticks on my new XO and also a miniSD(with SD adapter) and none of these (3) items are showing up in the Journal. I'm unable to access any of these and don't understand what I'm doing wrong. The USBs are both U3 Launchpad enable (only one is password protected). How can I make these Items work?

A: Make sure both cards have different Volume labels, as that's how they're assigned a mount point. See [1]

There's a hidden folder the OLPC puts onto all mounted media, ".olpc.store/". Try removing that, a broken database there may keep the journal from working properly. You should always be able to see the device mounted using "df" in Terminal.
Also, make sure they are FAT-formatted (most new USB sticks come FAT-formatted)—I think both FAT16 and FAT32 work. Also, I think the sticks/cards need to be writable for Sugar to index them correctly, so if your stick or card comes with a read-only switch, make sure it is in the read/write position and not the read-only position. I don't know much about the U3 system, but you might want to try non-U3, non-password-protected sticks to eliminate the possibility that your hardware is defective. If regular, brand-new sticks are not working, it is possible there is something wrong with the hardware of your machine, in which case you may want to contact the support line to see if it needs to be replaced (within the 30 day warranty period, if possible). —Joe 02:29, 29 December 2007 (EST)

Another thing to try is a quick reboot of the OLPC. I've had some difficulty with hot-swapping cards, but booting with them already attached seems to work much, much better.

Insertion

Note: The SD/MMC/SDHC memory card will only mount when inserted properly into the XO laptop. The slot will allow you to insert the card in either direction however. (It did not let me do that AaronPeterson 02:39, 3 January 2008 (EST))

To properly insert the SD/MMC/SDHC card the brass fingers on the card should be facing up and towards the front of the LCD screen. Insert the card until it is flush with the bottom of the screen, you will hear a click when the card is fully seated. [I had a hard time getting the card come out again. Using small tweezers I finally succeeded. Next time I attach a little piece of scotch tape to the SD card; this will give me an easy handle to pull the card out when it gets stuck. Geert December 28, 2007]

Not required, it is a Push to Click in and Push to Click out (Eject) mechanism. Once inserted push and release and the card will pop-out enough to comfortably remove - No sticky tape required. Ram (Boston, MA) January 8th 2008.

The picture below shows the proper way to insert the SD/MMC/SDHC card:


Proper SD Card Insertion.jpg

--KenXo 11:28, 24 December 2007 (EST)

Error Messages

I get an error about not being able to read block 0 of mmc1 when I turn on my XO. I've tried two cards, and those worked on another person's XO. I can't do anything to mount them AaronPeterson 02:39, 3 January 2008 (EST)

Some reports of issues, (currently in Ship.2 or pre Update.1 ?)

  • USB memory stick is removed after the Journal sees it; after that, the

Journal won't show the stick again until it is rebooted.

  • I tried unmounting a USB stick from the journal, and after removal I couldn't get the XO to remount the stick. Resolution: if unmounting doesn't seem to work, be sure to TURN OFF XO BEFORE REMOVING USB STICK or you could LOSE YOUR DATA. Once you've removed the stick after turning off XO, use a PC to remove the .olpc.store folder (rename it to something else if it doesn't let you delete it). The XO should then be able to mount it. For unmounting, you could also try doing so from the terminal's command line (use umount). Just make sure the stick is really unmounted (i.e. you can't see the corresponding folder under /media) before you pull it. Shi 13:36, 24 January 2008 (EST)
  • Suspend causes the SD card to come back with a device name one higher than before.

The best way to reboot is to go to the Home screen (with the XO in the middle and a donut of activities around it), hover the mouse over the XO, and click on Reboot.

Formatting (FAT 16 or 32)

(Adapted from support help answers)

SD cards are pre-formatted by their manufacturers to work best for the device; Recommend not reformatting unless it really stops working (e.g. if a freshly booted Linux refuses to mount it).

Instructions only for command line in Terminal.

The laptop doesn't come with the tools to format the SD card, so you will need to install them. With access to the Internet, you can install them as root by typing:

$ yum install dosfstools

This may take 5 to 10 minutes, then ask you if it's OK to download 71k of stuff, type "y" to download and install the "mkdosfs" command.

Insert your SD disk, check for current mount point, look for devices mounted in /media or /dev

$ df

or

$ mount

Look for similar devices as "/dev/mmcblk0p1" (meaning the first ("zeroth") MMC/SD card, and the first partition of that card. )

Then unmount any file system from the card, so that "df" doesn't show the card any more.

$ mount /dev/mmcblk0p1

Then "mkdosfs -F 32 /dev/mmcblk0p1" should reformat it as a FAT32 file system. (Use -F for FAT16/FAT file system, however 2 GB size limit)

Formatting and using with ext2

I moved the discussion of this to 'Talk'. I am having problems with the partition table disappearing. When this is more stable it can be moved back here. Rmyers 12:29, 18 February 2008 (EST)

Wikipedia