Tuesday, January 31, 2012

The Headache of a Separate /usr Partition

I installed Arch Linux inside a VirtualBox. Originally I made a bad decision and only allocated 20 GB for the whole Linux hard disk, among which root partition occupies 8.3 GB. Later on, I found that I need to squeeze disk spaces since the root partition is quickly occupied by ever increasing packages. Then I decided that I need to add another disk to balance the load of root partition. Which directory shall I put on the separate partition? After looking at the disk usage, /usr seems a nice candidate. So I created another virtual disk, moved all /usr content to that disk, and mount it as /usr. There were problems in this process since /usr contains many important binaries, but I overcome these issues. Finally I have enough space in my root partition, although everytime Arch Linux boot process complains that separate /usr partition is not supported. I didn't care since everything went fine.

Yesterday I rebooted Linux. During boot process, Linux complained that /dev/sdb1 is mounted. e2fsck: Cannot continue, aboring. I was given a typical panic screen to either enter root password and fix the problem, or hit Control-D to continue. /dev/sdb1 is where my current /usr partition. So I knew that I was finally hit by the separate /usr partition problem.

How to solve the problem? After Googling around, the solution is to disable boot time disk checking, as discussed here. So I entered root password, and mounted root partition as writable by typing mount -o remount,rw /. Then I edit /etc/fstab. The trick here is to change the last parameter (pass) to 0 for partition /dev/sdb1. The line

UUID=adbe588d-fd82-4ab1-b935-5ea245cf89fa /usr ext4 defaults,noatime,nodiratime 0 2
is changed to
UUID=adbe588d-fd82-4ab1-b935-5ea245cf89fa /usr ext4 defaults,noatime,nodiratime 0 0

There are issues with such solution though. Boot time disk checking is useful to ensure data consistency. The solution bypasses such safety guard. But currently I cannot find any other solutions to boot the Linux box. Since I cannot check the partition after booting (since /usr is busy), I may need other ways to check the partition (maybe boot via CD-ROM and check the partition manually). The lesson here is that a small decision error at the beginning may have large implications at the end.