差分

移動先: 案内検索

Astlinux 空き容量有効活用

7,505 バイト追加, 2008年5月24日 (土) 16:25
引越し引越しさっさと引越し【しばくゾ!】
英語版astlinuxが使用する(CFカードの)ディスクスペースは64MB。<BR>
AstLinux日本語版イメージは270MB弱。1GBのコンパクトフラッシュを使った場合、残った700MB以上の空きスペースは無駄になってしまうので、別パーティションを作ります。<BR>
今回使ったのはメルコ128MBコンパクトフラッシュ [http://buffalo.jp/products/catalog/item/r/rcf-x/ RCF-X128MY] です。(OSは英語版astlinux)
==FDISK==
fdisk /dev/hda と入力
fdisk /dev/hda
Forneus kd # fdisk /dev/hda

Command (m for help):
"n"(Newの略)を入力します。<BR>
command actionを聞かれたらpを入力します。<BR>
Command (m for help): n

command action
e extended
p primary partition(1-4)
次にパーティションナンバーを入力します。2と入力。<BR>
Partition number (1-4):
次はそのままデフォルト値で良いでしょう。そのままエンター<BR>
First cylinder (131-250, default 131):
次はサイズを聞かます。そのままエンター<BR>
Last cylinder or +size or +sizeM or +sizeK (131-250, default 250):
Using default value 250

Command (m for help):

pを入力し、現在の状況を確認します。<BR>
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を入力し、ディスクに書き込みます。<BR>
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.
==初期化==
次は未使用個所を初期化します。<BR>
再起動後、mke2fs -c /dev/hda2と入力します。<BR>
個体差はありますが、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と入力し、ディスクの容量を見てみます。<BR>
末尾に/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
==起動時の自動マウント==
再起動する度に手動でマウントさせる訳には行かないので、<BR>
適切なディレクトリに自動マウントさせます。
==設定変更==
/etc/rcを変更します。
Forneus / # mount -o rw,remount /
Forneus / # vi /etc/rc

/etc/rcというファイルは、Astlinux起動時のファイル操作スクリプトになっていますので、<BR>
このファイルに手を加えます。
===変更前===
/etc/rcの110~120行目あたりに、下記のような個所がありますので、<BR>
ここにマウントコマンドを一行追加します。
追加が終わったら、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で始まる行がある事)<BR>
を確認したら作業終了となります。
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 ~ #

案内メニュー

VoIp-Info.jp

HP Directplus -HP公式オンラインストア-