Creating a Swap Partition:
[root@dev ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 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 label type: dos
Disk identifier: 0x13fe498e
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 83 Linux
/dev/sdb2 4196352 8390655 2097152 8e Linux LVM
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (8390656-16777215, default 8390656):
Using default value 8390656
Last sector, +sectors or +size{K,M,G} (8390656-16777215, default 16777215): +2048M
Partition 3 of type Linux and of size 2 GiB is set
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 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 label type: dos
Disk identifier: 0x13fe498e
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 83 Linux
/dev/sdb2 4196352 8390655 2097152 8e Linux LVM
/dev/sdb3 8390656 12584959 2097152 83 Linux
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'
Command (m for help): p
Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 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 label type: dos
Disk identifier: 0x13fe498e
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 83 Linux
/dev/sdb2 4196352 8390655 2097152 8e Linux LVM
/dev/sdb3 8390656 12584959 2097152 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@dev ~]# partprobe
[root@dev ~]# mkswap /dev/sdb3
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=d2fde43f-4e96-42a5-9ac8-8cb7fa6d18c5
[root@dev ~]# swapon /dev/sdb3
[root@dev ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 4063228 0 -2
/dev/sdb3 partition 2097148 0 -3
Check Swap memory
[root@dev ~]# free -m
total used free shared buff/cache available
Mem: 3789 829 417 33 2542 2648
Swap: 6015 0 6015
Reduce Swap memory
[root@dev ~]# swapoff /dev/sdb3
[root@dev ~]# free -m
total used free shared buff/cache available
Mem: 3789 828 417 33 2542 2648
Swap: 3967 0 3967
No comments:
Post a Comment