ディスクの追加 CentOS on Virtual PC 2007 [コンピュータ]
Virtual PC 2007上のCentOSにハードディスクを追加する方法
参考(ほぼそのまま)
http://d.hatena.ne.jp/oragoku/20070724/1185283591
http://d.hatena.ne.jp/oragoku/20070725/1185464032
http://d.hatena.ne.jp/oragoku/20070726/1185464038
http://d.hatena.ne.jp/oragoku/20070727/1185548488
1.Virtual PCを停止する
2.バーチャルディスクウィザードで新しいディスクを作成する。
※サイズを20000MBで作った。
3.設定のハードディスク2に2のファイルを割り当てる。
4.CentOSを起動
5.rootで以下の操作をする。
fdiskで確認
[root@webgissv01 guest]# /sbin/fdisk -l Disk /dev/hda: 20.9 GB, 20971044864 bytes 255 heads, 63 sectors/track, 2549 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 2549 20370420 8e Linux LVM Disk /dev/hdb: 20.9 GB, 20971044864 bytes 16 heads, 63 sectors/track, 40634 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Disk /dev/hdb doesn't contain a valid partition table
パーティションを作成
[root@webgissv01 guest]# /sbin/fdisk /dev/hdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 40634. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-40634, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-40634, default 40634): Using default value 40634 Command (m for help): t Selected partition 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p Disk /dev/hdb: 20.9 GB, 20971044864 bytes 16 heads, 63 sectors/track, 40634 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hdb1 1 40634 20479504+ 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
追加したディスクパーティションをPV(Physical Volume)として定義
[root@webgissv01 guest]# /usr/sbin/pvcreate /dev/hdb1 Physical volume "/dev/hdb1" successfully created
PV情報表示
/usr/sbin/vgdisplay -v
追加したPV"/dev/hdb1"を既存VGに追加する。
[root@webgissv01 guest]# /usr/sbin/vgextend VolGroup00 /dev/hdb1 /dev/hdc: open failed: メディアが見つかりません Volume group "VolGroup00" successfully extended
VGから、新たにLV(LogicalVolume)を作成します。
[root@webgissv01 guest]# /usr/sbin/lvcreate -L 19.5G -n LogVol02 VolGroup00 Logical volume "LogVol02" created
※ここでサイズの指定がよく分からなかったので、20Gから少しずつ減らしていった。
情報表示・確認
/usr/sbin/vgdisplay -v
ファイルシステムをフォーマットします。
[root@webgissv01 guest]# /sbin/mkfs.ext3 -j /dev/VolGroup00/LogVol02 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 2555904 inodes, 5111808 blocks 255590 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=0 156 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 26 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
マウントします。
[root@webgissv01 guest]# mount /dev/VolGroup00/LogVol02 /opt/
確認
[root@webgissv01 guest]# df -h Filesystem サイズ 使用 残り 使用% マウント位置 /dev/mapper/VolGroup00-LogVol00 19G 19G 0 100% / /dev/hda1 99M 16M 79M 17% /boot tmpfs 125M 0 125M 0% /dev/shm /dev/mapper/VolGroup00-LogVol02 20G 173M 19G 1% /opt
/etc/fstabに追加
/dev/VolGroup00/LogVol02 /opt ext3 defaults 1 2
コメント 0