Astlinux 空き容量有効活用

提供: VoIP-Info.jp
2008年5月24日 (土) 16:25時点におけるMR G (トーク | 投稿記録)による版 (引越し引越しさっさと引越し【しばくゾ!】)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

英語版astlinuxが使用する(CFカードの)ディスクスペースは64MB。
AstLinux日本語版イメージは270MB弱。1GBのコンパクトフラッシュを使った場合、残った700MB以上の空きスペースは無駄になってしまうので、別パーティションを作ります。
今回使ったのはメルコ128MBコンパクトフラッシュ RCF-X128MY です。(OSは英語版astlinux)

FDISK

fdisk /dev/hda と入力

fdisk /dev/hda
Forneus kd # fdisk /dev/hda

Command (m for help):

"n"(Newの略)を入力します。
command actionを聞かれたらpを入力します。

Command (m for help): n

 command action
   e   extended
   p primary partition(1-4)

次にパーティションナンバーを入力します。2と入力。

Partition number (1-4):

次はそのままデフォルト値で良いでしょう。そのままエンター

First cylinder (131-250, default 131):

次はサイズを聞かます。そのままエンター

Last cylinder or +size or +sizeM or +sizeK (131-250, default 250):
Using default value 250

Command (m for help):

pを入力し、現在の状況を確認します。

Command (m for help): p

Disk /dev/hda: 129 MB, 129024000 bytes
16 heads, 63 sectors/track, 250 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *           1         130       65488+  83  Linux
/dev/hda2             131         250       60480   83  Linux

wを入力し、ディスクに書き込みます。
Syncing disks.と出たら成功。再起動するとFDISKでの変更が有効になります。

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

大雑把なfdiskのLOG

Forneus kd # fdisk /dev/hda

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (131-250, default 131):
Using default value 131
Last cylinder or +size or +sizeM or +sizeK (131-250, default 250):
Using default value 250

Command (m for help): p

Disk /dev/hda: 129 MB, 129024000 bytes
16 heads, 63 sectors/track, 250 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *           1         130       65488+  83  Linux
/dev/hda2             131         250       60480   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

初期化

次は未使用個所を初期化します。
再起動後、mke2fs -c /dev/hda2と入力します。
個体差はありますが、1,2分程度で終了するでしょう。

Forneus ~ # mke2fs -c /dev/hda2
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
15168 inodes, 60480 blocks
3024 blocks (5.00%) reserved for the super user
First data block=1
8 block groups
8192 blocks per group, 8192 fragments per group
1896 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345 

Running command: badblocks -b 1024 -s /dev/hda2 60480
sh: badblocks: command not found
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Forneus ~ #

マウント(テスト)

実際にマウントさせてみます。

Forneus mnt # mount /dev/hda2 /mnt/opt/

次に、dfと入力し、ディスクの容量を見てみます。
末尾に/dev/hda2が表示され、ディスク容量などが正しく表示されていれば、成功となります。

Forneus mnt # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda1                63413     52768     10645  83% /
none                       200         0       200   0% /dev
none                      5000       116      4884   2% /var
none                     10000       500      9500   5% /tmp
/dev/sda1                63413     52737     10676  83% /mnt/kd
/dev/hda2                58557        13     55520   0% /mnt/opt

起動時の自動マウント

再起動する度に手動でマウントさせる訳には行かないので、
適切なディレクトリに自動マウントさせます。

設定変更

/etc/rcを変更します。

Forneus / # mount -o rw,remount /
Forneus / # vi /etc/rc

/etc/rcというファイルは、Astlinux起動時のファイル操作スクリプトになっていますので、
このファイルに手を加えます。

変更前

/etc/rcの110~120行目あたりに、下記のような個所がありますので、
ここにマウントコマンドを一行追加します。 追加が終わったら、Astlinuxを再起動させます。

(略)
mount -t tmpfs -o size=200k none /dev
mount -t tmpfs -o size=5000k none /var
mount -t tmpfs -o size=10000k none /tmp
mkdir /dev/pts
mount -t devpts none /dev/pts
mount -t sysfs none /sys
mount -t usbfs usbfs /proc/bus/usb
mkdir /tmp/etc

echo "$ROOTDEV /             ext2    ro              0       0
proc    /proc           proc    defaults        0       0
none    /dev            tmpfs   size=200k       0       0
none    /tmp            tmpfs   size=10000k     0       0
none    /var            tmpfs   size=5000k      0       0
none    /proc/bus/usb   usbfs   defaults        0       0
" > /tmp/etc/fstab

if [ -d /stat/dev ]
(略)

変更後

(略)
mount -t tmpfs -o size=200k none /dev
mount -t tmpfs -o size=5000k none /var
mount -t tmpfs -o size=10000k none /tmp
mkdir /dev/pts
mount -t devpts none /dev/pts
mount -t sysfs none /sys
mount -t usbfs usbfs /proc/bus/usb
mount /stat/dev/hda2 /mnt/hda2          ←ここに追加
mkdir /tmp/etc

echo "$ROOTDEV /             ext2    ro              0       0
proc    /proc           proc    defaults        0       0
none    /dev            tmpfs   size=200k       0       0
none    /tmp            tmpfs   size=10000k     0       0
none    /var            tmpfs   size=5000k      0       0
none    /proc/bus/usb   usbfs   defaults        0       0
" > /tmp/etc/fstab

if [ -d /stat/dev ]
(略)

再起動後の確認

再起動後、dfと打ってみて、変更が反映されている事(/stat/dev/hda2で始まる行がある事)
を確認したら作業終了となります。

Forneus ~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda1                63413     52769     10644  83% /
none                       200         0       200   0% /dev
none                      5000       116      4884   2% /var
none                     10000       500      9500   5% /tmp
/stat/dev/hda2           58557        13     55520   0% /mnt/hda2
/dev/sda1                63413     52737     10676  83% /mnt/kd
Forneus ~ #