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.

Monday, November 7, 2011

Displaying ANSI Escape Sequences in Windows

I installed Busybox on my Samsung Galaxy S II to enjoy the Swiss Army Knife of Embedded Linux. When I want to look at my phone SD card content, I often use adb if the phone is connected with my laptop. So I typed the following command at Windows command prompt:

adb shell ls /sdcard

What I got is somehow scary as shown below (only first line is shown):

←[1;34mAndroid←[0m ←[1;34mTitaniumBackup←[0m

After a while, I realized that what is shown is actually ANSI escape codes. The ls command provided by Busybox is actually showing color codes by default.

So what shall I do? I know option --color=never can suppress ANSI escape sequences but I don't like typing such long keystrokes. On the other hand, getting useful information out of those ANSI codes is very difficult. My first reaction is trying to see whether Windows shell can show those ANSI codes. I remember my old friend DOS can display ANSI codes, so a modern Windows 7 should be able to do so. But I cannot find relevant configuration in Properties dialog of command prompt. After reading Wikipedia page on ANSI escape codes, I found the following sentence Console windows in all versions of Windows do not support ANSI escape sequences at all. Therefore the only solution is to find some console replacements which can show ANSI codes.

I do found some by Googling. But before trying one, I asked myself why I should install one software for just such a trivial task? I suddenly thought: how about Emacs shell? Maybe Emacs folks have already solved this issue? So I fired up Emacs, typed M-x shell, and typed adb shell ls /sdcard in Emacs shell. Bingo! All ANSI color codes are correctly shown, just as in an Linux box when typing ls --color.

Ubiquitous Emacs to the rescue again.

Saturday, September 10, 2011

Mobilizing All Forces

Recently I played a corresponding game at chess.com. It is one of the games I played in 16th Chess.com Tournament. It is an interesting demo on how Black can attack the King sides in King's Indian Defense. Below is the PGN and an embedded PDF analyzing the game.

[Event "16th Chess.com Tournament (1801-2000) - Round 1"]
[Site "Chess.com"]
[Date "2011.09.01"]
[White "ismail231"]
[Black "whily"]
[Result "0-1"]
[WhiteElo "1810"]
[BlackElo "1873"]
[TimeControl "1 in 3 days"]
[Termination "whily won by resignation"]

1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.Nf3 O-O 5.e4 d6 6.Be2 e5 7.O-O Nc6 8.d5
Ne7 9.b4 Nh5 10.Re1 f5 11.Ng5 Nf6 12.f3 Kh8 13.Be3 Bh6 14.Nf7+ Rxf7
15.Bxh6 f4 16.Rf1 Neg8 17.Bg5 h6 18.Bh4 g5 19.Bf2 Rg7 20.c5 g4 21.fxg4
Nxg4 22.Kh1 Qg5 23.Bf3 N8f6 24.Qe2 Nxf2+ 25.Rxf2 Bg4 26.Nb5 Bxf3
27.gxf3 Rag8 28.h3 Nh5 29.Qc2 Qg3 0-1
alt : 2011-09-01-ismail231-vs-whily-kid.pdf

Friday, August 26, 2011

The Power of Two Bishops

Recently I played a corresponding game at chess.com. It is one of the games I played in a Semi Slav thematic tournament. At the end of the game, my two bishops completely dominates the board. Below is the PGN and an embedded PDF analyzing the game.

[Event "12th Chess.com Thematic Tournament - Semi Slav (1801-2000) - Round 1"]
[Site "Chess.com"]
[Date "2011.08.01"]
[White "BennyNevis"]
[Black "whily"]
[Result "0-1"]
[WhiteElo "1768"]
[BlackElo "1876"]
[TimeControl "1 in 3 days"]
[Termination "whily won by resignation"]

1.d4 d5 2.c4 e6 3.Nc3 Nf6 4.Nf3 c6 {Thematic Game - This is the starting position.} 
 5.e3 Nbd7 6.Bd3 dxc4 7.Bxc4 b5 8.Bd3 Bb7 9.a3 Bd6 10.O-O O-O
 11.b4 a5 12.Rb1 axb4 13.axb4 Qe7 14.Qb3 Nd5 15.Nxd5 exd5 16.Bd2 Nf6 17.Ra1 Ne4 18.Bc3 Nxc3 
 19.Qxc3 Bxb4 20.Qc2 g6 21.g3 Bd6 22.Kg2 f6 23.Nd2 c5 24.dxc5 Bxc5 25.Bxb5 d4+ 26.Kg1 dxe3 
 27.fxe3 Qxe3+ 0-1
alt : 2011-08-01-bennynevis-vs-whily-semi-slav.pdf

Friday, August 19, 2011

Transition from Attack to Defense

Recently I played a corresponding game at chess.com. It is one of the games I played in a Ruy Lopez thematic tournament. I attacked first, but later on have to defense and lost the game quickly (as I thought). Below is the PGN and an embedded PDF analyzing the game.

[Event "Ruy Lopez - Round 1"]
[Site "Chess.com"]
[Date "2011.07.25"]
[White "nadreck"]
[Black "whily"]
[Result "1-0"]
[WhiteElo "2022"]
[BlackElo "1882"]
[TimeControl "1 in 5 days"]
[Termination "nadreck won by resignation"]

1.e4 e5 2.Nf3 Nc6 3.Bb5 {Thematic Game - This is the starting
position.}  Nf6 4.O-O Nxe4 5.Re1 Nd6 6.Bxc6 dxc6 7.Nxe5 Be7 8.d4 Be6
9.Bf4 O-O 10.c3 Nf5 11.Nd2 c5 12.g4 Nh4 13.dxc5 Bxc5 14.Ne4 Bd6
15.Nxd6 cxd6 16.Nd3 Qd7 17.f3 Qc6 18.Re3 Bxg4 19.Nb4 Nxf3+ 20.Kh1 Qd7
21.Rxf3 Bxf3+ 22.Qxf3 Rfe8 23.Rg1 Re6 24.Nd5 Rae8 25.Qg4 1-0
alt : 2011-07-25-nadreck-vs-whily-ruy-lopez.pdf