> Linux教程 > linux基础 >

设置swap分区的例子

设置swap分区的例子

以下是设置swap分区的例子
 

复制代码代码如下:
[root@localhost ~]# parted
GNU Parted 1.8.1
Using /dev/hda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpartfs                                                         
Partition type?  [logical]?                                               
File system type?  [ext2]? linux-swap                                     
Start? 15.1G                                                              
End? 16.2g                                                                
(parted) print                                                           

Model: VMware Virtual IDE Hard Drive (ide)
Disk /dev/hda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  107MB   107MB   primary   ext3         boot
 2      107MB   10.8GB  10.7GB  primary   ext3              
 3      10.8GB  13.0GB  2147MB  primary   ext3              
 4      13.0GB  42.9GB  30.0GB  extended                    
 5      13.0GB  15.1GB  2147MB  logical   ext3              
 7      15.1GB  16.2GB  1077MB  logical   linux-swap        
 6      16.2GB  18.2GB  1990MB  logical   ext2     
(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.     

#建立swap的文件格式

复制代码代码如下:
[root@localhost ~]# mkswap /dev/hda7
Setting up swapspace version 1, size = 1077473 kB
(责任编辑:IT)