EeePC Linux has its unique way to mount system drives which is completely different to standard Linux distributions (not even Xandros). In particular, /etc/fstab is ignored. Therefore, the usual Linux way of adding entries to /etc/fstab will not get any drive mounted automatically by the system.
[NB. If you want to use /etc/fstab to mount drives at bootup, you will need to add a “mount -a” command somewhere. However, since many system files are called by /sbin/fastinit, the only practical solution is to hexedit /sbin/fastinit as described in Option 2 below to add this “mount -a” command. Otherwise, you may run into a situation where a system file is called by /sbin/fastinit but it is still in a not yet mounted partition, and the system will hang up.]
To understand how we can mount drives at bootup, the following is a summary of the sequence and steps (commands) how drives are mounted during the boot process of EeePC Linux:
1) By initramfs
#mount /dev/sda1 as the SYSTEM partition mount -t ext2 -o ro $ROOT /mnt-system #mount /dev/sda2 as the USER partition mount -t ext3 -o rw /dev/sda2 /mnt-user #mount the SYSTEM and USER partitions together as the union filesystem, #or aufs (another union filesystem) for 900 and later models #for 701 model mount -t unionfs -o dirs=/mnt-user=rw:/mnt-system=ro unionfs /mnt #for 900 and later models mount -t aufs -o br:/mnt-user:/mnt-system none /mnt
2) By /sbin/fastinit
/bin/mount -n -o remount,ro / #for 900 and later models with 2 SSD #mount partition with Linux volume label "HOME" in /home /bin/mount -onoatime -L HOME /home > /dev/null 2>&1 #for 901 model /bin/mount -oremount,ro,noxino,del:/.rw /
3) By /usr/sbin/services.sh
#for 701 model #mount 2nd SSD (ATA disk), if any, to "My Documents 2" in $HOME if [ `cat /sys/block/sdb/device/vendor` = "ATA" ]; then mount /dev/sdb1 "/home/user/My Documents 2" #for 1000h model mount /dev/sda1 /ro -o ro
During the boot process of EeePC Linux, X Window is started by /sbin/fastinit (after mounting $HOME). So partitions containing any system file have to be mounted before X starts, i.e. either by /sbin/fastinit or by initramfs.
Depending on what folders you want to move to another partition, we have a few options:
The Linux command to mount partition is mount. The syntax of this command is:
mount -t [filesystem type] -o [options] [device] [mount point] #e.g. mount -t ext3 -o rw,user /dev/sdb1 /home/user/temp
If there is an entry in /etc/fstab giving details of how to mount this drive, then the filesystem type, options, etc. can be omitted in the mount command. For example, if you put this line into /etc/fstab:
#<device> <mountpoint> <fstype> <options> <dbg> <pass> /dev/sdb1 /home/user/temp ext3 rw,user 0 0
Then you can simply mount with these commands:
mount /home/user/temp mount /dev/sdb1 mount -a #mount all partitions specified in /etc/fstab
Besides specifying [device] in terms of device name, e.g. /dev/sdb1, it is also possible to specify device according to their volume label, serial number or UUID. The mount command can then be specified like this:
mount -t [fstype] -o [options] -L [label] [mount point] mount -t [fstype] -o [options] -U [uuid] [mount point]
e2label /dev/sdb1 [new label]
Below are some common examples of the mount command for some frequently used filesystem types. Please note that mount options will vary depending on fstype:
mount -o rw /dev/sda2 /mnt/sda2
[NB. For ext2/ext3 Linux partitions, you can simply omit the [fstype] in the mount command. However, if you specify fstype of ext3 while mounting an ext2 partition, the system will return an error]
mount -t vfat -o sync,gid=user,uid=user /dev/sdb1 /home/user/Windows
[NB. These options will give ordinary user privilege to write to the FAT32 partition]
mount -t ufsd -o iocharset=utf8,showmeta,uid=user,gid=user,fmask=0777,dmask=0777 /dev/sdb1 /home/user/Windows
[NB. These options will give ordinary user read/write/exec privilege to the NTFS partition and support for unicode characters]
#loop mount an iso9660 CD image mount -t iso9660 -o loop XXX.iso /home/user/CD
[NB. unionfs is not compatible with losetup. So you cannot place your iso image somewhere in the root filesystem that is mounted by unionfs. In 70x models, it means you have to place it in an USB device. For 900 and later models with 2 SSDs, you can place it in HOME.]
mount -t ext2 -o ro /dev/sda1 /mnt-system mount -t ext3 -o rw /dev/sda2 /mnt-user mount -t ext3 -o rw /dev/sdb2 /mnt-user2 #for 701 model with unionfs mount -t unionfs -o dirs=/mnt-user2=rw:/mnt-user=rw:/mnt-system=ro unionfs /mnt #for 900 and later models with aufs (another union filesystem) mount -t aufs -o br:/mnt-user2=rw:/mnt-user=rw:/mnt-system none /mnt
[NB. This example mounts /dev/sdb2 on top of the original union filesystem of /dev/sda1 and /dev/sda2 with both sda2 and sdb2 mounted read/write. To be able to do this, you will also need to mknod to create /dev/sdb2 in /module and mkdir to create the mounting point /mnt-user2 in initramfs]
For those who have an EeePC with 2 SSDs (e.g. 4G + 16G), yet run out of disk space in the 4G SSD and cannot install new softwares, there is really a cure to this stupid mistake of Asus: You can re-partition your 2nd SSD to create another Linux partition and mount it as part of the root filesystem by rebuilding the initramfs image.
The steps are as follows:
[NB. Steps 2-6 below are in fact quite similiar to step 3 of Part A onwards in this post: http://forum.eeeuser.com/viewtopic.php?pid=138554#p138554, except that the init script is more simple because we don't need to load USB drivers. So you can refer to that thread for more details.]
1) Repartition your 2nd SSD to create another Linux partition (e.g. /dev/sdb2) and format it to ext3
You will need to boot from another OS, e.g. Puppy Linux from CD or USB, to do this. Puppy Linux is bundled with the GUI GParted partition manager which is very user-friendly and is suitable for this job.
What you'll need to do is:
2) Rebuild initramfs with these CHANGES:
[NB. For details on how to rebuild the initramfs image, please refer to this wiki: Rebuilding initramfs (Initial RAM filesystem) of EeePC. Here I will only briefly cover the CHANGES you need to make.]
mknod -m 644 dev/sdb2 b 8 18
3) Edit /sbin/formatuser.sh and /sbin/scanuser.sh, find and replace all “sda2” with “sdb2”
For example, to edit the script /sbin/formatuser.sh in the default text editor, you can run this command in a terminal:
sudo kwrite /sbin/formatuser.sh
[NB. Verify the files still have exec permission after the modification. Otherwise, it can't run]
4) Copy everything from /dev/sda2 to /dev/sdb2 (If you do not want to configure your system from the beginning again)
#mount /dev/sda2 in /mnt/sda2 sudo mkdir /mnt/sda2 sudo mount /dev/sda2 /mnt/sda2 #mount /dev/sdb2 in /mnt/sdb2 sudo mkdir /mnt/sdb2 sudo mount /dev/sdb2 /mnt/sdb2 #copy files recursively from /mnt/sda2 to /mnt/sdb2, preserving all file attributes cd /mnt/sda2 cp -ax * /mnt/sdb2
5) Boot into rescue mode to implement the changes
You will need to move the modified /sbin/formatuser.sh, /sbin/scanuser.sh, initramfs image (and GRUB menu.lst if the modified initramfs image has a new name) from /dev/sda2 to the read only SYSTEM partition (/dev/sda1) as described in Steps to modify initramfs.
Now you can check in “Disk Utility” to see how much disk space you have on your system. It should be 2.7 GB (/dev/sda1) + say 4G (/dev/sdb2) = say 6.7 GB total.
Alternately, you can overlay the new partition /dev/sdb2 on top of the union filesystem of /dev/sda1 + /dev/sda2, then you can skip step 4, but there will be more changes you need to apply to the initramfs image, /sbin/formatuser.sh and /sbin/scanuser.sh for a complete solution.