Membuat Swap Linux

OS: CentOS release 6.5 (Final)
Software: dd

Create
:: Gunakan perintah dd untuk membuat file swap

[root@sgdo ~]# dd if=/dev/zero of=/root/swapfile bs=1024 count=2097152

2097152+0 records in
2097152+0 records out
2147483648 bytes (2,1 GB) copied, 309,31 s, 6,9 MB/s

Format
:: Format file swap

[root@sgdo ~]# mkswap /root/swapfile
mkswap: /root/swapfile: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=ce4eb392-1a15-45cc-a621-f6a23d0156ad

Permission
:: Ubah kepemilikan file swap

[root@sgdo ~]# chown root.root /root/swapfile
[root@sgdo ~]# chown 600 /root/swapfile

Aktivasi
:: Aktifkan file swap

[root@sgdo ~]# swapon /root/swapfile

Auto Boot
:: Konfigurasi di fstab

[root@sgdo ~]# vim /etc/fstab 

Check
:: Gunakan perintah free -m untuk melihat swapnya aktif atau belum

[root@sgdo ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           490        482          7          0         11        361
-/+ buffers/cache:        109        380
Swap:         2047          0       2047

Sumber
Share on Google Plus

About Admin

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments: