所有操作均需 root 权限
1.创建 swap 交换分区
首先用 fdisk -l 查看硬盘分区情况
1 | fdisk -l |
1 2 3 4 5 6 7 8 9 | Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x00097743 Device Boot Start End Blocks Id System /dev/sda1 * 1 2481 19922944 83 Linux |
只有一个分区.
新建一个分区, 用于 swap 交换.
1 | fdisk /dev/sda |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | [root@itnmg ~]# fdisk /dev/sda 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): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition 删除一个分区 l list known partition types m print this menu 显示帮助菜单 n add a new partition 新建一个分区 o create a new empty DOS partition table p print the partition table 显示分区表 q quit without saving changes 不保存退出 s create a new empty Sun disklabel t change a partition's system id 改变分区类型 u change display/entry units v verify the partition table w write table to disk and exit 保存退出 x extra functionality (experts only) Command (m for help): |
我们常用的的就是中文标出来那些了.