Review and Repair Linux Swap Partition-Troubleshooting Swap Partition

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1/8/2014

Review and Repair Linux Swap Partition-Troubleshooting Swap Partition

Review and Repair Linux Swap Partition


BY ADMIN JANUARY 8, 2014 LINUX HACKS, LINUX TIPS TRICKS, LINUX TRAINING IN INDIA, REDHAT LINUX, RHCE, RHCE TRAINING,RHCSS, UNCATEGORIZED

Review and Repair Linux Swap Partition GEEKS!! Sometimes it can happen that the partition contain your swap space refuses to work. Reasons can be many ranging from corrupted swap file system or bad sectors in the swap partition region. So we need to learn how to review and repair a Linux swap partition. Step #1. Check the existing swap partition for any bad sectors using the badblocks command. badblocks -v /dev/sdaX (replace X with your partition number i.e 1,2,3 ..)

Check Swap for Bad blocks Our command didnt returned any errors, so its a reason to celebrate. We dont have any bad sectors in the swap partition area. Step #2. In case you receive bad blocks, then you need to take the swap off and I recommend that check the block device again for bad blocks. You can also usemke2fs -c for the job. swapoff /dev/sdaX mke2fs -c /dev/sdaX

swap off & checking badblocks using mke2fs If the previous steps didnt throw you any errors then you can safely proceed to step #3. Step #3 . Now create the swap file system again using mkswap command, activate swap and mount it permanently in /etc/fstab.
http://www.networknuts.net/review-and-repair-linux-swap-partition/ 1/2

1/8/2014

Review and Repair Linux Swap Partition-Troubleshooting Swap Partition

mkswap /dev/sdaX swapon /dev/sdaX

create swap filesystem & activate it Step #4. Last step to make sure that the new swap file system should be available across the reboots. So we need to update entry of swap in /etc/fstab as we had re-created the file system. Copy the new UUID shown after the mkswap command, as shown in previous picture. Now edit the /etc/fstab so that it should look like this.

fstab file showing new UUID of swap

http://www.networknuts.net/review-and-repair-linux-swap-partition/

2/2

You might also like