Modify swap in ubuntu

Source: Internet
Author: User
Two cases: 1. directly modify the partition size 2. manually create a swap file under the existing partition and then activate the file. //////////////////////////////////////// //////////////////////////////////////// /// // First .. two cases:
1. directly modify the partition size
2. manually create a swap file under the existing partition and then activate the file.
//////////////////////////////////////// //////////////////////////////////////// ////////////////////////////////
In the first case, the partition creation and modification will not be mentioned. we recommend that you use fdisk, and other tools to modify the partition. after the partition is created, you need to do the following:
1. turn off the original swap.
Sudo swapoff-
2. comment out the swap under/etc/fstab.
3. find the UUID of the new partition.
Sudo blkid
4. modify/etc/fstab and add the new swap
5. activate the new swap (assuming the new partition is sda5)
Sudo swapon/dev/sda5
6. modify the UUID on/etc/initramfs-tools/conf. d/resume to the UUID of the new partition.
7. rebuilding the initrd file
Sudo update-initramfs-u
Case 2
1. create a Swap file
 
Mkdir swap
 
Cd swap
 
Sudo dd if =/dev/zero of = swapfile bs = 1024 count = 100000
 
2. convert the generated file into a Swap file
 
Sudo mkswap swapfile
 
Setting up swapspace version 1, size = 102395 kB
 
No label, UUID = 09fde987-5567-498a-a60b-477e302a988b
 
3. activate the Swap file.
 
Sudo swapon swapfile
 
4. if you need to keep this swap, you can write it into the/etc/fstab file. (View the UUID above)
 
Swapfilepath swap ULTS 0 0

From Wen Pingbo's column
Related Article

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.