前提 †LVM関連 †PV作成 †PV(Physical Volume)は物理ボリュームのこと。 ここでの作業の詳細は以下を参照。 作業 †ここではsdbに対してPVを作成していくのでそれに則って。
作業詳細
Ⅰ.ディスクフォーマット †sdb1を作成する。 # fdisk /dev/sdb(以下fdiskプロンプト) Command (m for help): m # ← ヘルプ Command (m for help): p # ← ディスクのパーティション情報表示 Disk /dev/sdb: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x76b4caa7 Device Boot Start End Blocks Id System この情報でこのディスクには何もパーティション情報がないことが分かる。 Command (m for help): n # ← 新しいパーティションを追加する Command action e extended p primary partition (1-4) p # ← プライマリパーティションを指定 Partition number (1-4): 1 # ← パーティションバンバー(sdb1とかのこと) First cylinder (1-51200, default 1): # ← 何もないところからなのでそのままリターン Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-51200, default 51200): Using default value 51200 Command (m for help): t # ← パーティションシステムを変更(Lで項目確認可能) Hex code (type L to list codes): 8e Command (m for help): p # ← 出来上がったかを確認する Disk /dev/sdb: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x76b4caa7 Device Boot Start End Blocks Id System /dev/sdb1 1 51200 52428784 8e Linux LVM # ← Linux LVMを確認 Command (m for help): w # ← ディスクに書き込む The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. ○ディスクパーティションを確認する # fdisk -l /dev/sdb1 Disk /dev/sdb1: 53.7 GB, 53687074816 bytes 64 heads, 32 sectors/track, 51199 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb1 doesn't contain a valid partition table Ⅱ.PV作成 †sdb1にPVを作成する。 # pvcreate -v /dev/sdb1 Set up physical volume for "/dev/sdb1" with 104857568 available sectors Zeroing start of device /dev/sdb1 Writing physical volume data to disk "/dev/sdb1" Physical volume "/dev/sdb1" successfully created 書式:pvcreate [オプション] [対象デバイス] ○PV情報を確認する # pvdisplay /dev/sdb1 --- Physical volume --- PV Name /dev/sdb1 VG Name PV Size 50.00 GiB / not usable 3.98 MiB Allocatable no PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx pvdisplayで確認しておく箇所は、 ここだけで良いと思う。 PV削除 †必要のなくなったディスクを削除する。 使用しているPVを削除しようとすると、 # pvremove /dev/sdc1 LV削除、VG削除と一部かぶってしまうが、作業方法としては # lvdisplay /dev/VolGroup03/LogVol00 マウントしている状態であれば先にマウントを外しておく。 # lvremove /dev/VolGroup03/LogVol00
Do you really want to remove active logical volume LogVol00? [y/n]: y 次にVGを削除する。 # vgdisplay VolGroup03 これもVGを消さずPVを消そうとすると怒られるので注意。 # vgremove VolGroup03 最後にPVを削除する。 # pvdisplay /dev/sdc1 # pvremove /dev/sdc1 以上でPVの削除は完了。 |