linux扩展swap分区:
[root@pow-altibase01 ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (4049-71797, default 4049): 4049
Last cylinder, +cylinders or +size{K,M,G} (4049-71797, default 71797): +59G
Command (m for help): p
Disk /dev/sdb: 590.6 GB, 590558003200 bytes
255 heads, 63 sectors/track, 71797 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x18104992
Device Boot Start End Blocks Id System
/dev/sdb1 1 4048 32515528+ 83 Linux
/dev/sdb2 4049 11751 61874347+ 83 Linux
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: 设备或资源忙.
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@pow-altibase01 ~]# reboot
Broadcast message from root@pow-altibase01
(/dev/pts/0) at 8:57 ...
The system is going down for reboot NOW!
重启后查看
[root@pow-altibase01 ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfbf90500
Device Boot Start End Blocks Id System
/dev/sda1 * 2 9 8192 41 PPC PReP Boot
Partition 1 does not end on cylinder boundary.
/dev/sda2 10 109 102400 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 110 1133 1048576 82 Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
/dev/sda4 1134 20480 19811326+ f W95 Ext'd (LBA)
Partition 4 does not end on cylinder boundary.
/dev/sda5 1134 20480 19811325+ 8e Linux LVM
Disk /dev/sdb: 590.6 GB, 590558003200 bytes
255 heads, 63 sectors/track, 71797 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x18104992
Device Boot Start End Blocks Id System
/dev/sdb1 1 4048 32515528+ 83 Linux
/dev/sdb2 4049 11751 61874347+ 83 Linux
Disk /dev/mapper/volGroup-volGroup--root: 53.6 GB, 53569650688 bytes
255 heads, 63 sectors/track, 6512 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@pow-altibase01 ~]# mkswap /dev/sdb2
Setting up swapspace version 1, size = 61874240 KiB
no label, UUID=c2bfe1ee-1821-4351-a451-592087a74d44
[root@pow-altibase01 ~]# swapon /dev/sdb2
[root@pow-altibase01 ~]# free -g
total used free shared buffers cached
Mem: 54 0 53 0 0 0
-/+ buffers/cache: 0 54
Swap: 60 0 60
[root@pow-altibase01 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Feb 25 07:10:22 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/volGroup-volGroup--root / ext4 defaults 1 1
UUID=fa8e42a0-ad95-45a1-a54c-a984c94f3327 /boot ext4 defaults 1 2
UUID=208f458a-a3c6-4bfd-8254-f1268f366288 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb2 swap swap defaults 0 0
~
~
~
~
~
"/etc/fstab" 16L, 855C written
再次重启验证
[root@pow-altibase01 ~]# reboot
Broadcast message from root@pow-altibase01
(/dev/pts/0) at 9:07 ...
The system is going down for reboot NOW!
[root@pow-altibase01 ~]# free -g
total used free shared buffers cached
Mem: 54 0 53 0 0 0
-/+ buffers/cache: 0 54
Swap: 60 0 60