User Tools

Site Tools


howto:format_sd

Formatting Secure Digital Cards

Formatting your SD(Secure Digital) card is fairly simple. In the default OS “Xandros” it can only be done from the command line, which you can bring up with <Alt><Ctrl><T>.

Windows Fat32

Fat32 is best for general compatibility for both windows, linux, and Mac. It is however limited to roughly 4 gig file sizes, and NO permission/ownership flags.

First become a “super user”

sudo -i

Xandros auto mounts the SD card when it's first inserted, so you will need to unmount it.

umount /dev/sdb1
  • Note: if you see the message “device is busy” it's possible that you need to use “sdc1” in the umount command. To check, plug in an SD card with something on it and use the File Manager to select the card and in the File menu choose Properties and note the line “Mounted from:” to check the device name.

Now that our SD card is unmounted we can format it.

mkdosfs -F 32 -n XXX /dev/sdb1

Replace “XXX” in the above with the volume name you want. If you want spaces, put the name in quotes. A volume name can be up to 11 characters in length. If you don't want a volume label, omit the ”-n XXX” entirely.

The characters ”<NAME>” will be used in the other sections below to stand for your chosen volume name.

Windows Fat16

Fat16 should be used when you need isolinux or any other bootloader/program that doesn't support fat32. You should note that it's limited to roughly 4 gig PARTITION and file sizes, and NO permission/ownership flags.

First become a “super user”

sudo -i

Xandros auto mounts the SD card when it's first inserted, so you will need to unmount it.

umount /dev/sdb1

Now that our SD card is unmounted we can format it.

mkdosfs -F 16 -n <NAME> /dev/sdb1

Linux Ext2

Ext2 is a good file system for linux when its used on the sd card. It should be noted however that in windows ext2 requires special drivers to use, so if you are going to be using the card in windows as well either find/install said drivers or use a different file system.

First become a “super user”

sudo -i

Xandros auto mounts the SD card when it's first inserted, so you will need to unmount it.

umount /dev/sdb1

Now that our SD card is unmounted we can format it.

mkfs.ext2 -L <NAME> /dev/sdb1

Optional

Finally, we will change the way the system has to mount the SD card so that the access to it is faster (otherwise, you will notice it is very slow due to the ext2 original settings). For this, just edit the file /sbin/probedevice:

sudo kwrite /sbin/probedevice

Find the following line:

*Ext2*)            options="ext2,rw,user,sync,suid,dev,exec";;

and modify it so it becomes:

*Ext2*)            options="ext2,rw,user,noatime,suid,dev,exec";;

Note that for Eee PC 900 the usbstorageapplet that automounts the removable devices, does not follow the above. One way to deal with it, is to use a manual script such as the one below, to remount your ext2/ext3 devices:

#!/usr/bin/perl

@mtab=`sudo cat /etc/mtab`;

foreach (@mtab) {
    if (/(.+) \/media\/(.): ext/) {
        system "sudo umount $1";
        system "sudo mount $1 /media/$2: -o rw,noatime";
    }
}

save the file giving it any name you want (e.g. “sd” ), then do a

chmod 777 sd
sudo cp sd /usr/bin/

Now, the command “sd” will remount your ext devices with the options “rw,noatime”. If you only wish the script to remount a specific device (e.g. /dev/sdc1 for the SD drive), you can add the device in the first parenthesis of the matching expression. So the if line would be:

    if (/(.+sdc1) \/media\/(.): ext/) {

Linux Ext3

The primary differences between ext2 and ext3 is that ext3 is a journaled file system. Although journaled file systems are considered superior to non-journaled file systems, It is not generally suggested for small flash based media.

First become a “super user”

sudo -i

Xandros auto mounts the SD card when it's first inserted, so you will need to unmount it.

umount /dev/sdb1

Now that our SD card is unmounted we can format it.

mkfs.ext3 -L <NAME> /dev/sdb1

Linux Minix

Minix is an older and fairly compact file system, so it will generally take less space. It should be noted that minix can not be read or written to by windows

First become a “super user”

sudo -i

Xandros auto mounts the SD card when it's first inserted, so you will need to unmount it.

umount /dev/sdb1

Now that our SD card is unmounted we can format it.

mkfs.minix /dev/sdb1

Others

Eeepc Xandros also supports cramfs(mkfs.cramfs) however it is designed to create compressed images rather then formatting a partition.

Further reading

The help command:

man mkdosfs

explains all the gory details of the mkdosfs command, and will be interesting reading if you have unusual formatting needs (for example, formatting a 4G card as fat16 for use in some digital cameras, bad block checking, etc.)

For detailed information about the mkfs.* commands, run

man mkfs
howto/format_sd.txt · Last modified: 2009/03/30 04:56 by jw4ee