2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ProxmoxVEに置いてるUbuntu 20.04のext4パーティションを拡張した

Posted at

忘れがちなのでメモ。

下準備

PVEの画面からVM > ハードウェア > ハードディスク(scsi0)を選択して、
ディスクの動作 > リサイズにて増やしたい分のサイズを追加してください。
見たな.png

今回は/dev/sda2を拡張します。

作業1

ubuntu@server:~$ sudo parted /dev/sda
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

Warning: Not all of the space available to /dev/sda appears to be used, you can
fix the GPT to use all of the space (an extra 419430400 blocks) or continue with
the current setting?
Fix/Ignore? Fix #ここでFixを選ぶ

#確認
(parted) p
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 322GB #/dev/sdaに増加分のサイズが割り当てられている
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  107GB   107GB   ext4 

(parted) resizepart 2 #/dev/sda2は2番なので2番をresize

#警告でたらYes

End? [107GB]? 100% #全部割り当て

(parted) quit #おわり

作業2

ubuntu@server:~$ sudo resize2fs /dev/sda2 #ext4のresize
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 38
The filesystem on /dev/sda2 is now 78642683 (4k) blocks long.

ubuntu@server:~$ df -h #確認
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           593M  2.6M  591M   1% /run
/dev/sda2       295G   75G  207G  27% /
tmpfs           2.9G  264K  2.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.9G     0  2.9G   0% /sys/fs/cgroup
/dev/loop1       56M   56M     0 100% /snap/core18/2812
/dev/loop3       81M   81M     0 100% /snap/ffmpeg/1286
/dev/loop2       64M   64M     0 100% /snap/core20/2105
/dev/loop4       41M   41M     0 100% /snap/snapd/20290
/dev/loop0       56M   56M     0 100% /snap/core18/2796
/dev/loop5       92M   92M     0 100% /snap/lxd/24061
/dev/loop6       64M   64M     0 100% /snap/core20/2015
/dev/loop7       71M   71M     0 100% /snap/lxd/21029
/dev/loop8       41M   41M     0 100% /snap/snapd/20671
tmpfs           593M     0  593M   0% /run/user/1000

おわり!

2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?