Exam EX200 All QuestionsBrowse all questions from this exam
Question 35

SIMULATION -

Add a swap partition.

Adding an extra 500M swap partition to your system, this swap partition should mount automatically when the system starts up. Don't remove and modify the existing swap partitions on your system.

    Correct Answer:

    To add a new 500M swap partition to your system and ensure it mounts automatically at startup, follow these steps. First, create the swap partition. Use the parted or fdisk utility to create a 500M swap partition. For instance, you can use 'sudo parted /dev/sdb' and execute a sequence of commands to create a new partition of type linux-swap. Next, initialize the swap area with the command 'sudo mkswap /dev/sdbX', where /dev/sdbX is the newly created partition. Enable the swap partition immediately using 'sudo swapon /dev/sdbX'. To ensure this partition mounts at startup, add an entry to /etc/fstab by editing the file and adding '/dev/sdbX swap swap defaults 0 0' at the end of the file. Save and exit the editor. Verify the changes have taken effect by running the command 'sudo swapon --show', which will list all active swap spaces.

Discussion
cloudyhr

create a partition for given size(500M) #fdisk /dev/sdb #n #+500M #w #partprobe check the present free memory #free -h #mkswap /dev/sdb5 #swapon /dev/sdb5 check the swap space and compai with privious value #free -h exit /etc/fstab and add below line /dev/sdb5 swap swap defaults 0 0 wright and exit /etc fstab # swapon -a

ly01

swapon sudo gdisk /dev/sdb -> ;n; +500M; 8200; w; y sudo partprobe lsblk sudo mkswap /dev/sdb2 lsblk -f sudo vim /etc/fstab -> /dev/sdb2 none swap defaults 0 0 sudo systemctl daemon-reload mount -a reboot swapon NAME TYPE SIZE USED PRIO /dev/dm-1 partition 3.8G 0B -2 /dev/sdb2 partition 500M 0B -3

Testo321

sudo parted /dev/sdb print (partition table unknown) sudo parted /dev/sdb mklabel gpt sudo parted /dev/sdb mkpart swap1 linux-swap 2084s 501M sudo parted /dev/sdb print sudo udevadm settle sudo mkswap /dev/sdb sudo vim /etc/fstab UUID=XXXXXXXXXXXXXXXXXXX swap swap defaults 0 0 sudo systemctl daemon-reload sudo swapon -a sudo swapon --show