21, Disk Management-linux add swap swap partition

Source: Internet
Author: User
Tags hex code

Add swap swap partition

Swap-swap is a function similar to the virtual memory of Windows system, the use of a portion of the hard disk space virtual into memory, so as to solve the situation of insufficient memory capacity, because swap is a hard disk resource virtual, so faster than real physical memory is much slower, Swap is typically called only when real physical memory is exhausted.

t :

command (M for  help ): T 
Selected partition 1

l :

hex code (type  l  to list  All Codes): l  
0 Empty NEC DOS bayi minix/o LD Lin BF Solaris
1 FAT12 Hidden NTFS win Linux swap/so C1 drdos/sec (fat-

82 represents the swap partition:

hex  code ( type  l  to list codes):  
class= "Hljs-type" style= "line-height:1.6;" >changed system type of partition 1 to ( linux swap/ solaris )

4. View the partition table information (existing partition information) again:

Command (M for Help):P

DISK/DEV/SDB:21.5GB,21474836480 bytes
255Heads theSectors/track,2610Cylinders
Units = Cylinders of 16065* +=8225280 bytes
Sectorsize(logical/Physical): + bytes/ + bytes
I/Osize(Minimum/Optimal): + bytes/ + bytes
Disk identifier:0x00000000

Device BootStartEndBlocksIdSystem
/dev/sdb112622104483+ theLinux Swap/solaris

5, Save the partition table settings:

command (M for help ): w 
The partition table has been altered!

calling ioctl () to re-read partition table .
Syncing disks.

6. Allow the kernel to synchronize partition information (this step only needs to be performed if no partition device is found, not necessary.) ):

[root@localhost ~]# partprobe

[[email protected] ~]# mkswap/dev/sdb1 
Mkswap:/dev/sdb1:warning:don ' t erase bootbits sectors
  &NBS P     (DOS Partition table detected). use - F to force .
Setting up Swapspace version 1 , size = 2104476 KiB
no Label, uuid =a77266ac-b078-45 F7-a329-b95219d90e2b

8, check the current memory usage situation, swap size is 2047:

[[Email protected] ~]# free-m
Total used FreeShared Buffers Cached
Mem:9806513290 +438
-/+ Buffers/cache: Max829
Swap:204702047

9. Enable the SDB1 swap partition:

[root@localhost ~]# swapon /dev/sdb1 

10. Check the memory usage of the current system again (swap is 4103m at this time):

[[Email protected] ~]# free-m
Total used FreeShared Buffers Cached
Mem:9806523280 +438
-/+ Buffers/cache:151 828
Swap:410304103

11, set to automatically mount the swap partition device after booting:

[[email protected] ~]# vim /etc/fstab
swapswap00


This article from "Live by the Sea like Waves" blog, please be sure to keep this source http://zhang789.blog.51cto.com/11045979/1847244

21, Disk Management-linux add swap swap partition

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.