Multiple partitions on a CF / SD card

From OESF

(Difference between revisions)
Jump to: navigation, search

Line 88:

Line 88:

. /etc/sdcontrol2
. /etc/sdcontrol2
 +
 +
exit 0
exit 0

Revision as of 21:17, 8 March 2005

Setting up multiple partitions on a CF or SD card may be quite useful. For example, to flash a new ROM image to a 5000/5500 you need a FAT partition on your CF card. On the other hand, installing programs to a card often requires a partition with symbolic linking support (i.e. not FAT). With a multi-partition setup, you can have your cake and eat it too - provided your cake is big enough (at least 64 MB).

Here is a step-by-step guide for setting up two partitions on a CF card: a FAT one and an ext2 one. It is based on the excellent [Step-by-step CF/SD fdisk/formatting for newbies] Howto. See the bottom of this page for notes on differences in an SD setup.

First download fdisk from http://www.killefiz.de/zaurus/showdetail.php?app=205 and install it. Try not to install it to the card you want to work with :-) Then, as root, type the following from the terminal:

   cd /root
   umount /dev/hda1
   fdisk /dev/hda (it will ask you for a command)
   d (this will delete a partition)
   1 (this will delete partition #1)
   n (this will create a new partition)
   p (this will create it as a Primary partition)
   1 (Choses partition 1)
   Enter (to take default start cylinder)
   N (integer, determines partition size: 1 < N < number of cylinders on the card)
   Enter (to confirm N as end cylinder)
   v (this will verify that the partition has been created)
   t (to change partition type)
   1 (to select partition 1)
   6 (to select FAT-16)
   n (this will create a new partition)
   p (this will create it as a Primary partition)
   2 (Choses partition 2)
   Enter (to take default start cylinder which will be N + 1)
   Enter (to take default end cylinder)
   v (this will verify that the partition has been created)
   t (to change partition type)
   2 (to select partition 2)
   83 (to select ext2)
   w (this will save the table and exit the fdisk program)

When you're done with fdisk, enter:

   mkfs.msdos /dev/hda1 (this will format the 1st partition with the FAT-16 file system)
   mkfs.ext2 /dev/hda2 (this will format the 2nd partition with the ext2 file system)
   mkdir /mnt/cf2 (this will create the directory where the 2nd partition will be mounted)

Now you need to edit /etc/fstab to associate the 2nd partition with its mount point (/mnt/cf2). The /etc/fstab file should already contain a line for the first partition and it should look something like this:

   /dev/hda1     /mnt/cf   auto   defaults,noauto,noatime,user,exec,suid   0 0

Use your favorite text editor to copy and tweak that line; you should end up with:

   /dev/hda1     /mnt/cf   auto   defaults,noauto,noatime,user,exec,suid   0 0
   /dev/hda2     /mnt/cf2  auto   defaults,noauto,noatime,user,exec,suid   0 0

If you want programs installed to the CF card to go to the ext2 partition rather than to the FAT one (and you do want that), you need to edit /etc/ipkg.conf, changing the line

   dest cf /mnt/cf

to

   dest cf /mnt/cf2

Finally, you want to __ensure that both partitions get auto-mounted__ when you reboot your Zaurus or eject / re-insert the CF card. For that, you need to edit /etc/pcmcia/ide.opts. This is not the place to explain how the file works (it contains explanatory comments if you care). I'll just list what you should end up with, omitting comments for brevity:

   case "$ADDRESS" in
   *,*,*,1)
      DO_FSCK="y"
      DO_MOUNT="y"
      ;;
   *,*,*,2)
      DO_FSCK="y"
      DO_MOUNT="y"
      ;;
   *,*,*)
      PARTS="1 2"
      NO_CHECK=n
      NO_FUSER=n
      ;;
   esac

The easiest way to apply all these changes is to restart your Zaurus whichever way your ROM allows. That's that.

The routine for SD cards is very much the same as far as I'm aware (I don't actually have an SD card so feel free to supply any practical experience). Simply replace /dev/hda1 with /dev/mmcda1, /dev/hda2 with /dev/mmcda2, /mnt/cf2 with /mnt/card2 and "dest cf" with "dest sd". Otherwise follow the instructions as outlined above.

Corrections are welcome.

When doing this on a sd card everything is about the same but the last part. I found it easier to do this. Log in as root.

 su

make the file system writable

 mount -n -o remount,rw /

copy a file and rename it

          cp /etc/sdcontrol /etc/sdcontrol2

I then had to edit the first file at the end.

. /etc/sdcontrol2


exit 0


open the file /etc/sdcontrol2 and change two values.

original /etc/sdcontrol

DEVICE=/dev/mmcda1 MOUNT_POINT=/mnt/card SMB_MOUNT=/home/samba/SD_Card

/etc/sdcontrol2

DEVICE=/dev/mmcda2 MOUNT_POINT=/mnt/card2 SMB_MOUNT=/home/samba/SD_Card I


Pop your sd card out and then back in and both partitions should now mount.

Personal tools