coLinux のディスクイメージのサイズを大きくしてみる

Windows なノート PC に coLinux が入ってると何かと便利。

というわけでいろいろモリモリ入れてると、どこかからもらってきた 1GB の Debian-4.0r0-etch.ext3.1gb では残り容量が心許なくなってきました。なのでサイズ大きくしてみます。

coLinux 自体はいつかスナップショットを持ってきた覚えがあるのでバージョンがはっきりしないですが、設定ファイルは XML ファイルじゃなくなってます。README.txt を見るとバージョン 0.8.0。uname -a の結果は Linux debian 2.6.17-co-0.8.0 #1 PREEMPT Sun Jul 8 14:00:12 CEST 2007 i686 GNU/Linux でした。

まずは Windows のコマンドプロンプトでイメージファイルを作成。5GB にします。


C:Program FilescoLinux>fsutil file createnew colinux.img 5368709120

次に coLinux の設定ファイルを編集し、末尾に今作成した cobd2=colinux.img を追加。


#
# This is an example for a configuration file that can
# be passed to colinux-daemon in this manner:
#
#    colinux-daemon @example.conf
#
# Note that you can still prepend or append configuration and
# boot parameters before and after '@', or you can use more
# that one '@ to load several settings one after another.
#
#    colinux-daemon @example.conf @overrider.conf mem=32
#
# Full list of config params is listed in colinux-daemon.txt.

# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
cobd0=Debian-4.0r0-etch.ext3.1gb

# Swap device, should be an empty file with 128..512MB.
cobd1=swap_device

# Tell kernel the name of root device (mostly /dev/cobd0,
# /dev/cobd/0 on Gentoo)
# This parameter will be forward to Linux kernel.
root=/dev/cobd0

# Additional kernel parameters (ro = rootfs mount read only)
ro

# Initrd installs modules into the root file system.
# Need only on first boot.
initrd=initrd.gz

# Maximal memory for linux guest
mem=128

# Slirp for internet connection (outgoing)
# Inside running coLinux configure eth0 with this static settings:
# ipaddress 10.0.2.15   broadcast  10.0.2.255   netmask 255.255.255.0
# gateway   10.0.2.2    nameserver 10.0.2.3
eth0=slirp,,tcp:2222:22/tcp:8080:80/tcp:8088:8080

# Tuntap as private network between guest and host on second linux device
#eth1=tuntap

# Setup for serial device
#ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on"

# Run an application on colinux start (Sample Xming, a Xserver)
#exec0=C:ProgramsXmingXming.exe,":0 -clipboard -multiwindow -ac"

cobd2=colinux_new.img

coLinux を起動しログイン。/dev/cobd2 として認識されているのでイメージを丸々コピーします。


[maihara@debian:~] $ sudo dd if=/dev/cobd0 of=/dev/cobd2
2095104+0 records in
2095104+0 records out
1072693248 bytes (1.1 GB) copied, 613.193 seconds, 1.7 MB/s

時間かかるので待ちます。

ファイルシステムをチェック、サイズを変更して全ての領域を使います。


[maihara@debian:~] $ sudo e2fsck -f /dev/cobd2
e2fsck 1.40-WIP (14-Nov-2006)
/dev/cobd2: 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

/dev/cobd2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/cobd2: 39866/131072 files (1.7% non-contiguous), 216011/261888 blocks

[maihara@debian:~] $ sudo /sbin/resize2fs -p /dev/cobd2
resize2fs 1.40-WIP (14-Nov-2006)
Resizing the filesystem on /dev/cobd2 to 1310720 (4k) blocks.
Begin pass 1 (max = 32)
Extending the inode table     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/cobd2 is now 1310720 blocks long.

終わり。


debian:~# shutdown -h now

等で coLinux を終了させます。

設定ファイルの cobd0 を今操作した colinux.img に変更して coLinux を再起動。


#
# This is an example for a configuration file that can
# be passed to colinux-daemon in this manner:
#
#    colinux-daemon @example.conf
#
# Note that you can still prepend or append configuration and
# boot parameters before and after '@', or you can use more
# that one '@ to load several settings one after another.
#
#    colinux-daemon @example.conf @overrider.conf mem=32
#
# Full list of config params is listed in colinux-daemon.txt.

# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
cobd0=colinux.img

# Swap device, should be an empty file with 128..512MB.
cobd1=swap_device

# Tell kernel the name of root device (mostly /dev/cobd0,
# /dev/cobd/0 on Gentoo)
# This parameter will be forward to Linux kernel.
root=/dev/cobd0

# Additional kernel parameters (ro = rootfs mount read only)
ro

# Initrd installs modules into the root file system.
# Need only on first boot.
initrd=initrd.gz

# Maximal memory for linux guest
mem=128

# Slirp for internet connection (outgoing)
# Inside running coLinux configure eth0 with this static settings:
# ipaddress 10.0.2.15   broadcast  10.0.2.255   netmask 255.255.255.0
# gateway   10.0.2.2    nameserver 10.0.2.3
eth0=slirp,,tcp:2222:22/tcp:8080:80/tcp:8088:8080

# Tuntap as private network between guest and host on second linux device
#eth1=tuntap

# Setup for serial device
#ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on"

# Run an application on colinux start (Sample Xming, a Xserver)
#exec0=C:ProgramsXmingXming.exe,":0 -clipboard -multiwindow -ac"

ログインしてサイズが増えていることを確認します。


[maihara@debian:~] $ df -h
Filesystem          サイズ  使用  残り 使用% マウント位置
/dev/cobd0            5.0G  828M  4.0G  18% /
tmpfs                  62M     0   62M   0% /lib/init/rw
udev                   10M   16K   10M   1% /dev
tmpfs                  62M     0   62M   0% /dev/shm

サイズが 5GB になりました。前の Debian-4.0r0-etch.ext3.1gb は用済みなので削除して作業完了です。


About this entry