Ubuntu 20.04¶
注意
本マニュアルに記載のOSは2025年5月8日をもって提供終了しました。
– |
プラン |
仮想CPU |
仮想メモリ容量 |
仮想ディスク容量 |
---|---|---|---|---|
スケールアップ前 |
512 MB |
1 CPU |
512 MB |
25 GiB |
スケールアップ後 |
1 G |
2 CPU |
1024 MB |
50 GiB |
警告
※ 2022/10/5以降の標準OSイメージのパーティション構成は、vda1, vda2 の2つとなることが有りますが、本手順では vda1, vda2, vda3 が既に存在する想定で記載しております。vda3が存在しない環境では、vda4 を vda3 にお読み替えください。
スケールアップを実施する¶
ヒント
スケールアップ実施の前に、重要なデータのバックアップ取得をお勧めいたします。
ディスク拡張の準備作業¶
サーバーを起動、ログイン¶
スケールアップ完了後、VPSコントロールパネルの「電源操作」から「起動する」を押して仮想サーバーを起動します。

VNCコンソールまたはSSH経由で仮想サーバーへログインし、ubuntuユーザーに切り替えます。
必要なパッケージをインストール¶
ディスクの状態の確認および拡張には、gdisk という名前のパッケージが必要です。もしインストールされていなければ、あらかじめインストールしておきます。
$ dpkg -l gdisk
dpkg-query: no packages found matching gdisk
$ sudo apt install -y gdisk
ディスクを拡張する¶
ディスクの状態を確認¶
現在のディスクの状況を確認します。
$ sudo gdisk -l /dev/vda
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/vda: 104857600 sectors, 50.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): A03E4053-C413-47CD-B0A7-AEEEEB699BF8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 52428766
Partitions will be aligned on 2048-sector boundaries
Total free space is 4541 sectors (2.2 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 primary
2 4096 8392703 4.0 GiB 8200 primary
3 8392704 52426239 21.0 GiB 8300 primary
$ lsblk /dev/vda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 50G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 4G 0 part [SWAP]
└─vda3 252:3 0 21G 0 part /
パーティションをソートする¶
$ sudo sgdisk -s /dev/vda
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
実行後、もう一度 gdisk コマンドでディスクの状況を確認します。
$ sudo gdisk -l /dev/vda
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/vda: 104857600 sectors, 50.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): A03E4053-C413-47CD-B0A7-AEEEEB699BF8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 104857566
Partitions will be aligned on 2048-sector boundaries
Total free space is 52433341 sectors (25.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 primary
2 4096 8392703 4.0 GiB 8200 primary
3 8392704 52426239 21.0 GiB 8300 primary
新しいパーティションを作成する¶
スケールアップにより増えたディスク容量を OS 認識ができましたので、gdisk コマンドで新しいディスクパーティションを作成します。
$ sudo gdisk /dev/vda
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
*[ n ] コマンドを入力します。新しいパーティションを作るという意味です。*
Command (? for help): n
*Partition number はデフォルトの [ 4 ] にしますので、そのまま [ Enter ] キーを押します。*
Partition number (4-128, default 4):
*Fisrt sector/Last sector もデフォルトの数値にするので、そのまま [ Enter ] キーを押します。*
First sector (34-104857566, default = 52426752) or {+-}size{KMGTP}:
Last sector (52426752-104857566, default = 104857566) or {+-}size{KMGTP}:
*Partition Type もデフォルトの [ Linux filesystem ] で問題がなければ、そのまま [ Enter ] キーを押します。*
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
*作成完了したので、 [ p ] コマンドでパーティションテーブルの確認をします。*
Command (? for help): p
Disk /dev/vda: 104857600 sectors, 50.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): A03E4053-C413-47CD-B0A7-AEEEEB699BF8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 104857566
Partitions will be aligned on 2048-sector boundaries
Total free space is 2526 sectors (1.2 MiB)
*表示されている新しいパーティションテーブルにサイズなどの問題がないことを確認します。*
Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 primary
2 4096 8392703 4.0 GiB 8200 primary
3 8392704 52426239 21.0 GiB 8300 primary
4 52426752 104857566 25.0 GiB 8300 Linux filesystem
*問題がなければ [ w ] コマンドを入力します。*
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
*もう一度確認をして問題がなければ [ y ]を入力して、 [ Enter ] キーを押します。*
*このコマンドを実行すると、ディスクの書き換えが発生するので、必ず確認した上で実行しましょう。*
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/vda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
ファイルシステムの作成¶
$ ls /dev/vda4
ls: cannot access '/dev/vda4': No such file or directory
vda4 が デバイスとして認識されていない場合、一度OSを再起動します。
$ sudo reboot
再起動が困難な場合は、以下のコマンドで強制的に認識させることも可能です。
$ sudo partx -a /dev/vda
vda4 がOSに認識されたら、 mkfs.ext4 コマンドでフォーマットを実行します。
$ sudo mkfs.ext4 /dev/vda4
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 6553600 4k blocks and 1641600 inodes
Filesystem UUID: e689b264-e14f-4e14-a062-c5d4d971cf9b
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
新しいディスクのマウント¶
$ sudo mkdir /data
$ sudo mount /dev/vda4 /data
マウントが完了したかどうかを確認します。
$ mount | grep vda4
/dev/vda4 on /data type ext4 (rw,relatime)
$ lsblk /dev/vda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 50G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 4G 0 part [SWAP]
├─vda3 252:3 0 21G 0 part /
└─vda4 252:4 0 25G 0 part /data
$ id=$(sudo blkid -o value -s UUID /dev/vda4)
$ echo "UUID=${id} /data ext4 defaults 0 2" | sudo tee -a /etc/fstab