1. Periksa apakah swap sudah aktip, bila belum lanjutkan ke langkah berikutnya.
# free
total used free shared buffers cached
Mem: 2054288 1916924 137364 4456 69268 1049580
-/+ buffers/cache: 798076 1256212
Swap: 0 0 0
2. Alokasikan 2Gb untuk swap file
# fallocate -l 2G /swapfile
3. Berikan mode 600 ke swap file
# chmod 600 /swapfile
4. Buatkan swapfile untuk file swapfile
# mkswap /swapfile
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=2947f0f6-d589-4837-a642-2f82f001d2fd
5. Aktipkan Swap file
# swapon /swapfile
6. Untuk memastikan swap file aktip, berikan perintah berikut:
# swapon --show
NAME TYPE SIZE USED PRIO
/swapfile file 2G 0B -1
7. Bisa juga ditampilan di memory dengan perintah free
# free
total used free shared buff/cache available
Mem: 16266308 1397436 11020044 291792 3848828 13464432
Swap: 2097148 0 2097148
8. Langkah terakhir yang sangat penting untuk mengaktipkan swapfile saat booting. tambahkan swapfile di /etc/fstab
vi /etc/fstab
9. Tambahkan kode berikut di file tersebut
/swapfile none swap sw 0 0
CARA MENAIKAN KAPASISTAS SWAPFILE
1. matikan dulu swapfile
# swapoff -v /swapfile
2. Alokasikan kapasitas swapfile misalnya menjadi 3Gb
# fallocate -l 3G /swapfile
3. Buatkan kembali swapfile
4. Aktipkan kembali swapfile
# mkswap /swapfile
# swapon /swapfile
CARA MENGHAPUS SWAPFILE
1. nonaktipkan terlebih dahulu swap file
# swapoff -v /swapfile
2. Hapus file swapfile
# rm /swapfile1
3. jangan lupa hapus kode di file /etc/fstab yang berisi swapfile
No comments:
Post a Comment