IV. The System Partition
The partition mounted as /system is automatically mounted as read only. It's like this because, even with root (the unlocked ability to make changes to the partition mounted as /system) it's dangerous to make changes there if you do not know what you are doing. When you flash a ROM from recovery, it wipes that partition, and writes new contents to it. Recovery scripts, however, are smart enough to mount this partition in rw mode. If you are going to make changes to /system while booted up in Android, you must have /system mounted as rw. Otherwise, you will just get permission errors even thought you have root level permissions.
To do this, you must remount the partition under /system as rw. There are many ways of doing this. All of them are system-wide. What that means is, if you use an app to remount /system as rw, the entire system and any other app will see it such until you reboot the phone or remount it as ro. Root explorer, for example, has an option in the top right corner to mount whatever file system you are currently browsing as either rw or ro depending on what it's currently mounted as. Basically, it toggles between rw and ro. There is also an app in the marketplace called "Mount /system (rw /ro)", which will do that as well if you don't have root explorer. Let's look at it in a little more detail, though.
Should you want to remount the partition mounted under /system as rw using the command line from a terminal emulator, you would run this:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
The "su" command is how you get root level permissions at the command line. You cannot change how a partition is mounted without it. Let's break down the second command:
- mount is the generic command used to view or modify currently mounted partitions or any media for that matter.
- -o is the option used to specify certain special mount options.
- a comma separated list following -o are the options you want to specify for mounting.
- remount means that the file system you are mounting is already mounted, and you want to specify some other options. You would leave this out if the filesystem was not mounted yet. As /system has to be mounted by virtue of the fact that you're using the system, you must specify the option to remount.
- rw means that you want /system to be mounted in read/write mode. By default, it is read-only, as previously explained.
- -t yaffs2 is the filesystem type of the partition. It's not that important for this explanation. Just understand that a partition must be formatted with a particular file system, which basically means how files are stored. Each operating system has the ability to understand certain file system types. More on this later.
- /dev/block/mtdblock4 is the logical location of the partition itself under /dev as previously explained. Should you want to mount a different partition, you would replace this line with it.
- /system is the location under / where the files belonging to the mtdblock4 partition will be made accessible. In the case of a remount, these last two strings should not change from how it is currently mounted. For example, if /system was mounted as /asdfasdf (just an example), you should not use remount to then mount it as /system. You'd stick with /asdfasdf. Just a point to remember; it will always be /system in this case. This is not the case if youíre mounting something for your own use, but changing the mount point of /system would be detrimental.
Once the above is done, a user can then make changes to /system, but only as the root user, of course. This requires using the terminal emulator after having typed "su" OR using an app that can run as the root user and browse all partitions. An example is Root Explorer.
Once the user is done making changes, /system should be remounted in ro mode, again, to avoid making unwanted changed. It's the safe thing to do. Rebooting will take care of it, but it can be done much quicker by reverting the change manually. Root explorer has the toggle, as does the other mentioned app. To do it from the terminal emulator, type:
mount -o remount,ro -t yaffs2 /dev/block/mtdblock4 /system
The only difference between the two commands is that rw changed to ro. That's it.
V. Current Mounts
If you want to see how the system is currently using various partitions, you can run the mount command from the terminal emulator by itself, with no arguments or options. It will list several things including the partition itself, the mountpoint for said partition, and options used while mounting it (such as rw or ro). If you are interested in only a particular partition, run:
where whateverpartition is the partition you want to see. For example, to see how /system is currently mounted:
You will see something like:
/dev/block/mtdblock4 /system yaffs2 ro 0 0
All of that information should look familiar now. The 0 0 at the end are other options that you donít need to be concerned with outside or real Linux administration.
Having an understanding of how this works will help you determine ways of saving space and making the most of your available storage. The three major partitions are /data, /system, and /cache. A majority of your 1 GB of internal storage is used by these. The partitions sizes are set when the partitions are created. By default, this is how they are partitioned:
/system Ė 350 MB
/data Ė 430 MB
/cache Ė 160 MB
As you can see, you only have 430 MB for apps and data. Thatís less than half of the advertised space. There are numerous apps on the market that will display the free space available on each partition, but it can be done from the command line as well by typing this:
That will show all mounted partitions, how big they are, and how much free space you have. You can check the same for just one partition by doing something like:
df -h /system
You can, of course, replace /system with whatever partition you want to see. You will probably notice that both /system and /cache have a lot of free space. As it turns out, most of that free space rarely gets used, and cannot be used by you for apps, at all. Itís wasted space. Cache, of course, will show mostly free space, but itís necessary for things like OTAs, which will download to that directory. It does need to be somewhat large, but not *that* big. In any case, there are ways of having more space available than just 430 MB. The best place to start is a2sd.