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?

メモリスワップ

Last updated at Posted at 2025-02-09

1. スワップの追加

スワップファイルの作成と有効化

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

スワップファイルを起動時に自動で有効化

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

2. 使用量の監視

ディスク使用量の確認

sudo df -h

特定ディレクトリの使用量確認

sudo du -sh /var/*

3. スワップファイルの無効化

スワップファイルの無効化

sudo swapoff /swapfile

/etc/fstab ファイルからスワップの設定を削除

sudo nano /etc/fstab

次の行を探し削除

/swapfile none swap sw 0 0

変更を保存し、エディタを終了

4. スワップファイルの削除

スワップファイルを削除して、ディスクスペースを確保

sudo rm /swapfile

スワップファイルが正常に削除されたことを確認

sudo swapon --show
free -h
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?