Friday 9 August 2019

AWS - Add swap Volume on EC2 Instance

Step 1: Create SWAP Volume . Volume type Magnetic (Standard)














Step 2 : Attach Volume













Step 3: Swap commands on EC2



[root@OEL_7 ~]# mkswap /dev/xvdh1
Setting up swapspace version 1, size = 2096124 KiB
no label, UUID=25ec5f9f-97cc-426e-955f-a9ece392da1d
[root@OEL_7 ~]# swapon /dev/xvdh1
[root@OEL_7 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/xvdh1                              partition       2096124 0       -2
[root@OEL_7 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:            989          40         828          12         120         894
Swap:          2046           0        2046
[root@OEL_7 ~]# vi /etc/fstab
[root@OEL_7 ~]# mount -a
[root@OEL_7 ~]# df -ah
Filesystem      Size  Used Avail Use% Mounted on
rootfs             -     -     -    - /
sysfs              0     0     0    - /sys
proc               0     0     0    - /proc
devtmpfs        480M     0  480M   0% /dev
securityfs         0     0     0    - /sys/kernel/security
tmpfs           495M     0  495M   0% /dev/shm
devpts             0     0     0    - /dev/pts
tmpfs           495M   13M  482M   3% /run
tmpfs           495M     0  495M   0% /sys/fs/cgroup
cgroup             0     0     0    - /sys/fs/cgroup/systemd
pstore             0     0     0    - /sys/fs/pstore
cgroup             0     0     0    - /sys/fs/cgroup/pids
cgroup             0     0     0    - /sys/fs/cgroup/blkio
cgroup             0     0     0    - /sys/fs/cgroup/perf_event
cgroup             0     0     0    - /sys/fs/cgroup/freezer
cgroup             0     0     0    - /sys/fs/cgroup/cpu,cpuacct
cgroup             0     0     0    - /sys/fs/cgroup/memory
cgroup             0     0     0    - /sys/fs/cgroup/hugetlb
cgroup             0     0     0    - /sys/fs/cgroup/cpuset
cgroup             0     0     0    - /sys/fs/cgroup/net_cls,net_prio
cgroup             0     0     0    - /sys/fs/cgroup/devices
configfs           0     0     0    - /sys/kernel/config
/dev/xvda1       15G  7.1G  6.9G  51% /
selinuxfs          0     0     0    - /sys/fs/selinux
mqueue             0     0     0    - /dev/mqueue
debugfs            0     0     0    - /sys/kernel/debug
hugetlbfs          0     0     0    - /dev/hugepages
systemd-1          -     -     -    - /proc/sys/fs/binfmt_misc
binfmt_misc        0     0     0    - /proc/sys/fs/binfmt_misc
sunrpc             0     0     0    - /var/lib/nfs/rpc_pipefs
tmpfs            99M     0   99M   0% /run/user/1000
/dev/xvdf1       99G   61M   94G   1% /oracle
/dev/xvdg1      9.8G   37M  9.2G   1% /oradata
[root@OEL_7 ~]# cat /fstab
cat: /fstab: No such file or directory
[root@OEL_7 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Nov 27 11:40:36 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d5388b06-35e3-435e-8eaf-09a08de83883 /                       ext4   defaults     0 0

/dev/xvdf1 /oracle ext4 defaults 0 0
/dev/xvdg1 /oradata ext4 defaults 0 0
/dev/xvdh1 swap swap 0 0
[root@OEL_7 ~]#

[root@OEL_7 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Nov 27 11:40:36 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d5388b06-35e3-435e-8eaf-09a08de83883 /                       ext4   defaults     0 0

/dev/xvdf1 /oracle ext4 defaults 0 0
/dev/xvdg1 /oradata ext4 defaults 0 0
/dev/xvdh1 swap swap 0 0
[root@OEL_7 ~]#


No comments:

Post a Comment