Q.1 What is SWAP
Space?
Answer:
Swap space in Linux is used when the amount of
physical memory (RAM) is full. If the system needs more memory resources and
the RAM is full, inactive pages in memory are moved to the swap space. While
swap space can help machines with a small amount of RAM, it should not be
considered a replacement for more RAM. Swap space is located on hard drives,
which have a slower access time than physical memory.
Q2. What is swap
id
Answer:
82
Q3.What are the
steps to create SWAP files or Partition?
Answer:
1> - Create swap partition or file
2> - Write special signature using “mkswap”
3> - Activate swap space by “swapon –a” command
4> - Add swap entry into /etc/fstab file
Q4. How you will create swap file of size 4 GB
and explain swap file entry in /etc/fstab file?
Answer:
Step1: Use “dd” command to create swap file.
Step2: dd if=/dev/zero
of=/SWAPFILE bs=1024 count=4
Step3: mkswap /SWAPFILE
Step4: swapon –a
Step5: Entry into /etc/fstab file.
/SWAPFILE
swap swap defaults
0 0
Q5. Tell me the steps to remove the swap file?
Answer:
1) Firstly disable the swap file by “swapoff” command.
2) Remove Swap file entry from /etc/fstab file.
3)Now remove the swap file by “rm” command.
Q6.How to Clear Swap Space in Linux?
Answer:
If you want to clear Swap space, you may like to run the below command.
# swapoff -a && swapon -a
Q7.How to Check Swap Space in Linux using /proc/swaps file.?
Answer:Type the following cat command to see total and used swap size:
# cat /proc/swaps
Sample outputs:Filename Type Size Used Priority /dev/sda3 partition 6291448 65680 0Q8.How to Check Swap Space in Linux using grep command.?
Answer:
#grep Swap /proc/meminfo
SwapCached: 0 kB SwapTotal: 524284 kB SwapFree: 524284 kBQ9. How to check swap size in Linux using vmstat command.?
Answer:Type the following vmstat command:
# vmstat
# vmstat 1 5
Sample outputs:procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 9 1209512 101352 1504 127980 0 3 11 20 60 55 3 1 95 1 2 11 1209640 101292 1508 134132 844 424 5608 964 23280 15012 2 8 20 70 0 10 1210052 108132 1532 125764 648 660 10548 916 22237 18103 3 10 11 77 1 13 1209892 106484 1500 128052 796 240 10484 980 24024 12692 2 8 24 67 1 9 1209332 113412 1500 124028 1608 168 2472 620 28854 13761 2 8 20 70Note down the following output from swap field:
- si: Amount of memory swapped in from disk (/s).
- so: Amount of memory swapped to disk (/s).
Q10. How to check swap size in Linux using free command.?
Answer:#free -h*********** Thanks*********
No comments:
Post a Comment