by peaslaker » Wed Apr 27, 2011 9:03 am
Your mistake (one that is commonly made) is thinking that automatic mounting of partitions is normal for Linux. It is not.
Linux separates the process of having a disk present in the system by first initialising the relevant device drivers to provide block device access via a special device files (/dev/sda, /dev/sdb etc.) then it unravels the partitioning scheme on the disk to link the partitions to (/dev/sda1, /dev/sda2 etc.) device files. At this stage the disk partitions are still unmounted - block level operations can be performed such as 'dd', 'fdisk', 'fsck' and 'mkfs.XXXX'. Mounting is the separate second stage process of integrating the partition's filesystem at a mount point in the existing root filesystem.
Many Linux distributions add features to automatically mount partitions. The most fundamental of these is the /etc/fstab file which is read by the system initialisation scripts and is used to mount the necessary partitions at their appropriate location. Many systems also add automount functionality, which allows partitions to be mounted on access, following a set of simple rules files and then unmounted after a period in which the partition is not accessed. Arch Linux ARM uses a simpler scheme using a udev rule to mount the drive - this feature is so annoying that I usually disable it - in its current form it even tries to mount swap partitions.
UBIT is not a GNU Linux distribution - it is a minimal ramdisk environment that runs in 7MB of RAM for install and root filesystem initialisation, disappearing from memory when its work is done. Instead of using the GNU C libraries, it uses uClibc which is a smaller, cut-down set of C libraries that aren't entirely standards compliant. Instead of using individual GNU Linux utilities, it uses busybox which is a compact multifunction program that provides basic utilities without guaranteeing them to be standards compliant. Instead of using udev, UBIT uses mdev. GNU Linux distributions include a collection of initialisation scripts, which also handle system shutdown and unmounting of mounted partitions. UBIT doesn't include complicated init and shutdown scripts because it is a closed environment performing a very simple set of tasks - because there are no shutdown scripts, you can't have random partitions mounted by an automated process because they will never be unmounted and you will be guaranteeing a non-clean shutdown each and every time.
In an install environment there is no correct place to expect partitions to be mounted - partitions have no defined function until you install some content on them. The way UBIT manages partition mounting is to perform mounting and unmounting as a wrapper on a specific UBIT installation task. This is the reason for the on /dev/sda1 XXXXXXXX format of commands. This command sets up a randomised mount point in the /tmp directory, mounts the partition, performs the command, unmounts the partition and then deletes the temporary mount point.
You can perform multiple commands on a partition by initialising a shell on that partition: $this->bbcode_second_pass_code('', 'on /dev/sda1 sh')
When you exit the shell it will unmount the partition.