How to modify the swap partition size after installing Linux

Source: Internet
Author: User

test environment for RH AS4
If you don't know what the swap is, or the concept of partitioning, the following procedure may be risky for you.
It is also convenient to enlarge your own swap. You must have root authority, the process must be very careful, accidentally destroyed the entire hard disk data, perform the following process before you need to think twice, the consequences of the error by the performer himself, I this script only as a reference.
1. Enter the console with root
2. #swapoff-a #停止交换分区
3. #fdisk/dev/hda #swap所在硬盘的硬盘设备文档, it may be different, you'd better check/etc/fstab will have swap this line of hd* behind the numbers removed
4. In Fdisk, use D to delete the swap partition first, and then n add partition (add the hard disk must have free space, the spatial size of the parameter is the number of cylinders cylinders, not bytes, you need to calculate, p command to see the number of bytes per cylinder), Then use T to change the newly added partition ID to a (Linux swap type), and use W after each step to actually write the operation to the hard drive (no use of w before your operation is invalid). Again, this step must be very careful, a mistake your system may be broken, data loss.
5. #mkswap/dev/hda6 #格式化swap分区, the hda6 here depends on the actual partition device name displayed after you add the P command
6. #swapon/dev/hda6 #看是否能够启动新的swap分区
7. Modify the device name of swap in/etc/fstab such as/dev/hda6 (if you do not change the location, usually the same as before), let him start the load himself. It should be noted that if you were originally a label=swap-hda6, then you have two options: first. Change him to the actual device name, such as:/dev/hda6. Second, do not change the/etc/fstab, the command line in the 5th step needs a slightly different #mkswap-L SWAP-HDA6/DEV/HDA6 that is, the format of the SWAP partition with a label, the function is only supported in the new release, can be used Mkswap- Help to see if he supports-l option.
8. Reboot, all OK

This article is from the "lake and Laughter" blog, please make sure to keep this source http://xuexuhui.blog.51cto.com/9647696/1663762

How to modify the swap partition size after installing Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.