coLinux のパーティションサイズを大きくする
cvs で NetBSD のソースコードチェックアウトしてたら、途中でパーティションの容量を使い果たしてしまった。パーティションサイズ(イメージファイルのサイズ)を大きくする方法をメモしておく。
Windows XP であれば、fsutil というコマンドで手軽にイメージの作成ができるらしいけど、自分が使っている Windows 2000 には入ってないので、Windows版 ddコマンドを使うことにした。
1.Windows版 ddコマンドをダウンロード
chrysocome.net - dd for windows
2.コマンドプロンプトからイメージの作成(5 GB にした)
C:\Program Files\coLinux\Fedora7>dd if=/dev/zero of=fedora_5gb.img bs=16384 coun t=327680 rawwrite dd for windows version 0.5. Written by John Newbigin <jn@it.swin.edu.au> This program is covered by the GPL. See copying.txt for details 327680+0 records in 327680+0 records out
<block_device index="2" path="\DosDevices\c:\Program Files\coLinux\Fedora7\fedora_5gb.img" enabled="true" />
4.coLinux を起動し、現在のイメージを先ほど作ったイメージにコピーする
~% sudo dd if=/dev/cobd0 of=/dev/cobd2 Password: 8191937+0 records in 8191937+0 records out 4194271744 bytes (4.2 GB) copied, 1621.97 s, 2.6 MB/s
5.ファイルシステムのチェックをする
~% sudo /sbin/e2fsck -f /dev/cobd2 Password: e2fsck 1.39 (29-May-2006) /: recovering journal Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /: ***** FILE SYSTEM WAS MODIFIED ***** /: 338229/1022976 files (1.6% non-contiguous), 970935/1022127 blocks
6.ファイルシステムのサイズを拡大する
~% sudo /sbin/resize2fs /dev/cobd2 Password: resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/cobd2 to 1310720 (4k) blocks. The filesystem on /dev/cobd2 is now 1310720 blocks long.
7.先ほど colinux.xml に追加した部分を削除し、以下の行を加える
<block_device index="0" path="\DosDevices\c:\Program Files\coLinux\Fedora7\fedora_5gb.img" enabled="true" />
後は、coLinux を再起動するだけ。
~% df -k Filesystem 1K-ブロック 使用 使用可 使用% マウント位置 /dev/cobd0 5082656 3674244 1198700 76% / tmpfs 63184 0 63184 0% /dev/shm
微妙に 5GB(1024^3 * 5) に達していないけど気にしないことにする。(恐らく、スーパーユーザの5%分が引かれているのだと思う。参考:UNIXシステム管理 第3版〈VOLUME2〉の p.556)
参考
:情報源
ExpandingRoot - coLinux:Windows版 ddコマンド の情報
coLinuxのパーティションを大きくする:作成済みのイメージもダウンロードできるらしい
UNIXの部屋 コマンド検索:dd (*BSD/Linux):ddコマンドの詳しい解説