Adding Swap File Space in a Linux System

2 399 0
Adding Swap File Space in a Linux System

Đang tải... (xem toàn văn)

Thông tin tài liệu

1 - 2 IT Essentials II v2.0 - Lab 7.2.6 Copyright  2002, Cisco Systems, Inc. Lab 7.2.6: Adding Swap File Space in a Linux System Estimated Time: 20 minutes Objective To assess and add swap space in a Linux Red Hat operating system. Equipment • A computer with Linux Red Hat 7.X installed Scenario The system administrator of a large company notices that one of the Linux Apache Web servers for the internal company Web site has been running slowly, and most of its resources have been used up. Most of the IT budget for the year has been spent. Therefore, adding more RAM is not an option. The administrator decides to add more swap space to the server instead. Procedures Step 1: Assessing swap usage In order to determine how much swap space to add, first look at the size of some files on the system. Determine how much memory is being used and how much is left on the system. The free command in Linux can be used to check the system memory. Type free –m –t at the shell prompt. How much physical memory is available? How much physical memory is being used? __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ 2 - 2 IT Essentials II v2.0 - Lab 7.2.6 Copyright  2002, Cisco Systems, Inc. Step 2: Adding a swap file To add swap space on a system, add a swap file by using the following steps: 1. Create a file that is equal in size to the swap file that is going to be created. Do this by using the dd command. Enter the following command at the shell prompt: dd if=/dev/zero of=swap.swp bs=1024 count=131072 2. The swap.swp file that was created will need to be initialized. When it is initialized, the Linux system can use it to swap memory to a disk. Use the mkswap command to enable Linux to use the new swap file. However, the new swap file will not be active. Enter the following command at the shell prompt: mkswap –f /root/swap.swp or type /sbin/mkswap –f /root/swap.swp 3. To activate this swap file, use the swapon command. To make this swap file inactive, use the swapoff command in place of the swapon command. Enter the following command at the shell prompt: swapon /root/swap.swp or type /sbin/swapon /root/swap.swp The swap file that was just created will not be used the next time the system is rebooted unless the entry in made in /etc/fstab. Reflection This method is the quickest and easiest way to add swap space. However, it does create some problems. By creating this swap file on a partition that is already being used, the file can become fragmented as the partition gets used more and more. What are some other methods that can be used to add a swap file? . To assess and add swap space in a Linux Red Hat operating system. Equipment • A computer with Linux Red Hat 7.X installed Scenario The system administrator. Essentials II v2.0 - Lab 7.2.6 Copyright  2002, Cisco Systems, Inc. Step 2: Adding a swap file To add swap space on a system, add a swap file by using the

Ngày đăng: 16/10/2013, 21:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan