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

保存領域拡張

0
Posted at

自分の備忘録。

1. 不要なパーティションの削除

スワップを一旦オフにする

sudo swapoff -a
sudo fdisk /dev/sda

ここから対話モード:

p を入力して現在の状況を表示(sda1以外のパーティションがあることを確認、ここではsda2とsda5とする)

d を入力 → 5 を入力(論理パーティションを削除)

d を入力 → 2 を入力(拡張パーティションを削除)

p を入力して、sda1 だけが残っていることを確認

w を入力して保存(ここで初めてディスクに書き込まれる)

2. 拡張

sudo parted /dev/sda resizepart 1 100%

3. ファイルシステムのサイズ更新

sudo resize2fs /dev/sda1

4. スワップ復活

# 4GBのスワップファイルを作成
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# 再起動後も有効にするために追記
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?