LoginSignup
0
0

More than 3 years have passed since last update.

LVMでボリューム拡張手順(虎の巻)

Posted at

ボリューム拡張が必要になってくると思うのでその覚書

基本的にCentOS系のOSで検証をしているけど、Debianでも使えると思う

前提条件:VirtualBoxのHDDがVDI形式であること

vmdkだと可変ではないので拡張できない、そういった場合は別のHDDを作ってそれをアタッチメントすればよい

以下はVirtualBoxで拡張後にゲストOS内で認識させる方法

fdiskを実行して新規パーティションを立てる

ブロックサイズは認識されているので基本的にはおおもとの/dev/sdaを参照する。
/dev/sdaは

[root@localhost ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p
Disk /dev/sda: 33.3 GB, 33263140864 bytes ★ ここが 現時点のサイズと違う状態であれば使っていない空間がある
255 heads, 63 sectors/track, 4044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00070a84

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1306     9972736   8e  Linux LVM


パーティションを新規に作成するので"n"を選択して作成

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4) ★ 基本はこっちを選択する
p


今回はパーティション3を作成する。
限定的な容量追加など特別の事情がない限り後はデフォルトでOK

Partition number (1-4): 3
First cylinder (1306-4044, default 1306):
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-4044, default 4044):
Using default value 4044

確認のため"p"で確認をする。

Command (m for help): p

Disk /dev/sda: 33.3 GB, 33263140864 bytes
255 heads, 63 sectors/track, 4044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00070a84

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1306     9972736   8e  Linux LVM
/dev/sda3            1306        4044    21997670   83  Linux ★ここが追加されていればOK
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0