Filesystem organization in the Archos Angstrom system

The stock Archos 5 hard disk has two partitions, one of which is very much larger than the other. The smaller partition, typically /dev/sda1, is invisible to the user with the stock firmware, although it is accessible to a host computer over USB in recovery mode. This smaller partition contains the Archos root and /opt filesystem images, among other things, and in practice is too small to be useful for much else. While some owners have reported success repartitioning the disk so that the partitions are more even in size, or even in creating new partitions, I suspect that many people won't want to do this.

This means that if we are to run a desktop-like Linux distribution, the full Linux system needs to fit into /dev/sda1, which has to be in vfat format if AVOS is to continue to run properly alongside Angstrom (not to mention for Windows compatibility). Conventionally a Linux system will have separate partitions for the root filesystem, for /usr, /boot, /home, /opt, swap, and perhaps others. In this application we perhaps don't need this level of sophistication, but clearly we can't just put the whole Linux filesystem on /dev/sda1, or even in a single filesystem image in /dev/sda1.

There are two reasons we can't simply put the entire Linux installation into one big root filesystem image somewhere in /dev/sda1.

  • We don't have a patching process for the core distribution. In the long term such a thing might be necessary. At present, the only way to get updates is by installing a whole new root filesystem. This means that everything will be overwritten, including user config and data in /home. That's particularly problematic for apps that store data in $HOME and don't offer any alternative
  • We need some way to share data with a host computer over USB. We can't share the whole of /dev/sda1 (because most likely the root filesystem is there). And we can't share the root filesystem image, because it would have to unmounted before exporting over USB, and that's not going to work as the filesystem will be in use.

At present, therefore, we make use of three filesystem images.

  • The root filesystem. This defaults to /rootfs.img on /dev/sda1, the this location can be changed by providing a new location in a menu file (if you're using the multi-root support -- see here.
  • The /home filesystem. Regardless of the location of rootfs.img, the home filesystem image will be /home.img on /dev/sda1. Within the running Angstrom, this image file looks like /mnt_data/home.img. At present this image is ext3 format an 100Mb in size.
  • The /usbshare filesystem. This is a filesystem that can be switch back and forth between a local mount and an export over USB using the g_file_storage driver. This filesystem is in a vfat image at /usbshare.img on /dev/sda1.

Of these filesystems, only rootfs.img need be installed by the user. The others are created automatically if they don't exist: this is checked on each boot.

In summary, the mount arrangement is:

 [location of rootfs] -> /rootfs_source
 /dev/sda1 -> /mnt_data
 /mnt_data/home.img -> /home
 /mnt_data/usbshare.img -> /usbshare

Some things to note:

  • The multi-root arrangement allows any location for the root filesystem, so location of rootfs need not be /dev/sda1. But whether it is or not, /dev/sda1 will be mounted on /mnt_data. We don't assume that the home filesystem image lies alongside the root filesystem image -- the root filesystem might be on a USB stick, for all we know. But the home filesystem has to go somewhere. The location can be changed by editing `/etc/fstab' if necessary, but you'll have to create and populate the home filesystem at whatever location you choose.
  • The location of the /usbshare image and its partition are specified in /etc/a5usb.rc. But I recommend against changing these -- at present other utilities make assumptions about their locations.