Do You need more Swap space for your linux system? the biggest problem is, where does it come from? The ideal setup is to have an actual partition dedicated to being used as swap space.This article will guide you through creating a disk partition — a contiguous area on a physical or virtual hard disk — on a Linux-based system and converting it to a Swap area in order to increase the RAM capacity of a computer system.
Most current Linux distributions use the GNU Parted utility to partition disks. To create a partition, you’ll need to make sure that you’re running your computer as a superuser. After that, determine which disk you would like to partition and use the fdisk utility to create a partition.
Once you’ve obtained root privileges, you’ll need to identify the disk that you want to partition:
sudo fdisk -l
The output from this command will look something like this:
Disk /dev/sda: 21.5 GB, 21474836480 bytes
4 heads, 16 sectors/track, 655360 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
In this example, you can see that there’s a 21.5 GB drive which is located at /dev/sda. This is the drive that we will be partitioning.
Once you’ve identified the drive you would like to partition you can use the fdisk utility to create a partition.
sudo fdisk /dev/sda
After running this command, You’ll be presented with the fdisk prompt where you can enter commands to create or delete partitions.
You’ll now want to create a new partition. To do that, enter the “n” command which will open a new partition window.
You’ll now be asked how much space you want to allocate to your new partition. Enter the size and select the “primary” option.
Once you have created the partition, you’ll need to set it as a Swap partition. To do this, you’ll need to enter the “t” command, then select the partition number of the newly created partition. This will open a window where you’ll be asked to enter the partition type, which is “82”.
Finally, after you’ve done all the above, you’ll need to save the changes. To do this, enter the “w” command and the changes will be written to disk.
The newly created Swap partition is now ready to be used. You can enable it by running the following command:
sudo mkswap /dev/sda1
And then, turn it on with the following command:
sudo swapon /dev/sda1
Now, you’ve successfully created a new Swap partition in Linux! You can check the output of the ‘free -m’ command to make sure that the Swap space has been added, and you can modify the ‘/etc/fstab’ file to make sure that the partition is automatically enabled at every reboot.
香港服务器选创新互联,2H2G首月10元开通。
创新互联(www.cdcxhl.com)互联网服务提供商,拥有超过10年的服务器租用、服务器托管、云服务器、虚拟主机、网站系统开发经验。专业提供云主机、虚拟主机、域名注册、VPS主机、云服务器、香港云服务器、免备案服务器等。
当前题目:分区Linux系统下创建Swap分区的指南(linux创建swap)
URL标题:http://www.mswzjz.cn/qtweb/news6/328106.html
攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能