拡張する場合は、拡張するパーティションの後ろに空き領域が必要となります。 ... に空き領域が必要となります。 書式:resize2fs [デバイス名] Shell. ファイルシステムをチェックします。 [root@vxxx-xxx-xxx-xxx ~]#e2fsck -f /dev/vdb . /dev/vdbに対し、早速パーティション編集をしていきましょう。 パーティション編集は、fdisk デバイス名 と実行します。 # fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). OS: Ubuntu 12.04 HDD: 100GB → 150GB. ?g 0 /dev/vdc2 rhel lvm2 a– ? ←上記で作成したデバイス.
これでLVMは28GBから36GBに拡張されました。 まだ、ファイルシステムで拡張していないので領域は増えて …
例:/dev/vdb ⇒ /dev/vdc ) 03. Logical volume centos/root successfully resized.
Changes will remain in memory only, until you decide to write them.Be careful before using the write command. 1 # resize2fs /dev/vdb . ディスク管理関連 ディスク情報の表示[fdisk -l] $ sudo fdisk -l ディスク /dev/vda: 256 GiB, 274877906944 バイト, 536870912 セクタ 単位: セクタ (1 * 512 = 512 バイト) セクタサイズ (論理 / 物理): 512 バイト / 512 バイト I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト ディスクラベルのタイプ: dos ディスク識別 … Changes will remain in memory only, until you decide to write them.
現在のディスクの状況を確認します。 # gdisk -l /dev/vda GPT fdisk (gdisk) version 0.8.10 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. 【fdiskでパーテーションの拡張】 [root@aaa homepage]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). ~]# umount /dev/vdb1 2. fdisk partition_name を実行します。 たとえば、以下のようになります。 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2).
Disk /dev… その度に新しく仮想HDDを作ることはしたくないため、容量拡張とUbuntuでの設定方法を調べました。 今回の環境. ディスクを拡張する ディスクの状態を確認.
Changes will remain in memory only, until you decide to write them. 今回の拡張に伴い、新たに必要となるリソースは以下の通りです。 100GB HDD 1台; NIC(ネットワークインタフェースカード) 1枚 ... /dev/vdb /data ext4 defaults 0 2 ※ここでは記述内容の詳細は割愛します . Disk / dev / vdb: 10. 仮想HDDの容量拡張. Be careful before using the write command. 仮想hddの拡張 † 仮想hddの容量拡張をおこなっても、ゲストos側のパーティションは変更前の設定になっている。 その為、容量拡張を行った後にゲストos側でもパーティションのリサイズをする必要がある。 物理ボリュームを拡張する ・状態確認 # pvs PV VG Fmt Attr PSize PFree /dev/vda2 centos lvm2 a– ?
~]# umount /dev/vdb1 2. fdisk partition_name を実行します。 たとえば、以下のようになります。 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). $ sudo fdisk /dev/vdb Welcome to fdisk (util-linux 2.27.1).
Opts: SELinux: initialized (dev vda1, type ext4), uses xattr vdb: unknown partition table ここでは、 “vdb: unknown partition table” となっているものが新しくアタッチされたデータディスクで、 パーティションテーブルがまだないということがわかります。
?g 0 ←追加した空領域 ・拡張 # vgextend rhel /dev/vdc3.
05. Command (m for help): 3.
物理ボリュームを作成する # pvcreate /dev/vd??
追加ディスクのマウントを解除します。 [root@vxxx-xxx-xxx-xxx ~]#umount /dev/vdb . ディスク / dev / vdb: 85.9 GB, 85899345920 バイト ヘッド 16 , セクタ 63 , シリンダ 166440 Units = シリンダ数 of 1008 * 512 = 516096 バイト
7 GB, 10737418240 bytes, 20971520 sectors:ここから下が / dev / vdb に関する情報です。 Units = sectors of 1 * 512 = 512 bytes Sector size ( logical / physical ) : 512 bytes / 512 bytes I / O size ( minimum / optimal ) : 512 bytes / 512 bytes
追加ストレージをマウントする(Linux編) 追加ストレージを仮想サーバーにアタッチ(接続)しただけでは、ストレージ領域をご利用いただけません。 コマンド (m でヘルプ): p ← 「p」を入力 Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = シリンダ数 of 16065 * 512 = 8225280 bytes デバイス Boot Start End Blocks Id System /dev/sdb1 1 125 1004031 83 Linux ← 新しいパーティションができた 04. ?g 0 /dev/vdc3 lvm2 — ? # lvextend -l +100%FREE /dev/centos/root Size of logical volume centos/root changed from 27.46 GiB (7031 extents) to 35.50 GiB (9089 extents). Device does not contain a recognized partition table Disk: /dev/vdb Size: 500 GiB, 536870912000 bytes, 1048576000 sectors Label: dos, identifier: 0x874ecaad Device Boot Start End Sectors Size Id Type /dev/vdb1 * 2048 838862847 838860800 400G 83 Linux /dev/vdb2 838862848 872417279 33554432 16G 5 Extended mqFree space 838864896 872417279 33552384 16G >> /dev/vdb3 872417280 1006635007 134217728 64G 82 Linux swap / …
... $ sudo resize2fs /dev/ubuntu-vg/root 拡張後のサイズは以下のとおりです。
Changes will remain in memory only, until you decide to write them.Be careful before using the write command. Be careful before using the write command. Be careful before using the write command. Changes will remain in memory only, until you decide to write them.
Command (m for help): 3. fdisk -l コマンドを実行し、パーティションの詳細を一覧にし、 拡張前のパーティションの最終サイズと最初のセクターを記録します。 fdisk [device name of data disk] コマンドを実行し、fdisk へ移動します。 この例ではデバイス名は /dev/vdb です。 まずDiskの容量が拡張されていることを確認します。 [root@vxxx-xxx-xxx-xxx ~]#fdisk -ul /dev/vdb .
Disk / dev / vdb: 10. NICの追加.