サーバ管理
運用中にディスク容量が不足したら新しいディスクを増設しましょう。手順は以下の通りです。
(1)新しいディスクの認識
(2)formatコマンドによるパーティション作成
(3)newfsコマンドによるファイルシステム構成
(4)mountマウントによるマウント
(5)/etc/vfstabによるOS起動時自動マウント設定
それでは順番に細かく見ていきましょう。
新しいディスクをシステムに接続し、OSに認識させます。詳しくはデバイス認識のところを参照下さい。
formatコマンド→partitionサブコマンドにてパーティションを作成し、最後にlabelサブコマンドでVTOCに保存します。
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t2d0
/pci@1f,0/ide@d/dad@2,0
Specify disk (enter its number): 0 // 新ディスク選択
selecting c0t2d0:
[disk formatted, no defect list found]
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> partition // partitionサブコマンド選択
PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> 0 // パーティションを選択
Part Tag Flag Cylinders Size Blocks
0 home wm 5141 - 19155 27.27GB (14015/0/0) 57181200
Enter partition id tag[home]:
Enter partition permission flags[wm]:
Enter new starting cyl[5141]:0 // スタートシリンダ
Enter partition size[57181200b, 14015c, 19155e, 27920.51mb, 27.27gb]:10gb
partition>
// 作成したいパーティション分だけ繰り返す
partition>label // 最後にlabelサブコマンドでVTOCに保存します
partition>quit
formatコマンドでパーティションが切れたら、newfsコマンドでファイルシステムを作成します。
パーティション分だけ繰り返す。
# newfs /dev/rdsk/c0t2d0s0 # newfs /dev/rdsk/c0t2d0s3 # newfs /dev/rdsk/c0t2d0s5 ・・・
あとは、マウントポイント用のディレクトリを作成して、mountコマンドでマウントするだけです。
# mkdir /mnt1 /mnt2 /mnt3 # mount -F ufs /dev/dsk/c0t2d0s0 /mnt1 # mount -F ufs /dev/dsk/c0t2d0s3 /mnt2 # mount -F ufs /dev/dsk/c0t2d0s5 /mnt3
OS起動時に自動的にマウントしたい場合は、/etc/vfstabに以下のエントリを追加します。
# vi /etc/vfstab --- /dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 /mnt1 ufs 2 yes - /dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s3 /mnt2 ufs 2 yes - /dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s5 /mnt3 ufs 2 yes -