Study for the TestOut Linux Pro Exam with our engaging quiz. Prepare using our flashcards and comprehensive multiple choice questions, each with hints and explanations to help you succeed. Get ready for your Linux certification today!

Practice this question and more.


After adding RAM, how would you activate a new swap partition?

  1. swapoff /dev/sdb2

  2. mkswap /dev/sdb2

  3. swapon /dev/sdb2

  4. mount /dev/sdb2 /mnt/swap

The correct answer is: swapon /dev/sdb2

To activate a new swap partition after adding RAM, the command used is `swapon /dev/sdb2`. This command informs the Linux kernel that the specified partition should be utilized as swap space, allowing the system to use this additional memory resource. Swap space is an area on a hard disk that is used when the amount of physical RAM is full; it provides a way for the system to manage memory more effectively. The process typically starts from the creation of the swap partition and setting it up to be recognized by the system. While `mkswap` is utilized to set up the filesystem on the swap partition, it only prepares it; it does not activate it. The `swapon` command is necessary to make that swap space actively available for use by the system. Using `swapoff /dev/sdb2` would disable the swap space instead of enabling it, and `mount /dev/sdb2 /mnt/swap` would not apply, as swap partitions are not mounted like regular filesystems; instead, they are activated with the `swapon` command. Hence, the right command to use for activating a new swap partition is indeed `swapon /dev/sdb2`.