Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
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 action
e extended
p primary partition (1-4)
p --选择分区类型
Partition number (1-4): 1 --指定分区号
First cylinder (1-130, default 1): 1 --指定歧视磁柱号
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): 130 --指定结束磁柱号
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdc1 1 130 1044193+ 83 Linux
Selected partition 1
Hex code (type L to list codes): 82 --82是swap的分区id号
Changed system type of partition 1 to 82 (Linux swap)
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdc1 1 130 1044193+ 82 Linux swap
The partition table has been altered!
Syncing disks.
[root@redhat ~]# fdisk -l --显示所有分区信息
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sda1 * 1 905 7269381 83 Linux
/dev/sda2 906 1044 1116517+ 82 Linux swap
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdb1 1 1044 8385898+ 83 Linux
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sdc1 1 130 1044193+ 82 Linux swap
[root@redhat ~]# mkswap /dev/sdc1 --对sdc1格式化为swap格式
Setting up swapspace version 1, size = 1069248 kB
[root@redhat ~]# free --查看当前虚拟内存情况
total used free shared buffers cached
Mem: 1034564 465176 569388 0 13928 365672
-/+ buffers/cache: 85576 948988
Swap: 1116508 0 1116508 --虚拟内存总量为1116508
[root@redhat ~]# swapon /dev/sdc1 --启动虚拟内存
[root@redhat ~]# free --查看当前虚拟内存情况
total used free shared buffers cached
Mem: 1034564 465696 568868 0 13956 365644
-/+ buffers/cache: 86096 948468
Swap: 2160692 0 2160692 --虚拟内存总量增加
二、建立一个swap文件
如果不想建立一个swap分区,可以建立一个swap文件,而且步骤更加的简单:
1、用dd指令建了一个swapfile;
2、用mkswap将swapfile格式化为swap文件格式;
3、用swapon启动该文件(用swapoff关闭)
1024+0 records in
1024+0 records out
[root@redhat ~]# ll /tmp/swap
-rw-r--r-- 1 root root 1073741824 Oct 31 18:52 /tmp/swap
[root@redhat ~]# mkswap /tmp/swap --用mkswap格式化swapfile
Setting up swapspace version 1, size = 1073737 kB
[root@redhat ~]# free --查看当前虚拟内存情况
total used free shared buffers cached
Mem: 1034564 1008344 26220 0 6276 906844
-/+ buffers/cache: 95224 939340
Swap: 1116508 0 1116508 --当前是1116508
[root@redhat ~]# swapon /tmp/swap --启动swapfile
[root@redhat ~]# free --再次查看虚拟内存情况
total used free shared buffers cached
Mem: 1034564 1008792 25772 0 6292 906828
-/+ buffers/cache: 95672 938892
Swap: 2165076 0 2165076 --虚拟内存增加
转载地址:http://hi.baidu.com/alizee635_2012/item/cf5c50b7aea8fd9018469773
628



被折叠的 条评论
为什么被折叠?



