磁盘管理---分区---parted命令

    实验举例:

        

[root@server254 devices]# parted /dev/sdb

(parted) help

(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags

 1      32.3kB  214MB  214MB  primary
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

(parted) mkpart     

 

     创建分区 :                                                   
Partition type?  primary/extended? primary                               
File system type?  [ext2]? ext4                                          
Start? 1                                                                 
End? 200M                                                                
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags

 1      1049kB  200MB  199MB  primary

(parted) mkpart                                                          

Partition type?  primary/extended? primary                               
File system type?  [ext2]? ext4                                          
Start?                                                                   
Start? 200M                                                              
End? 2000M                                                               
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

 1      1049kB  200MB   199MB   primary
 2      200MB   2000MB  1799MB  primary

(parted) mkpart                                                          

Partition type?  primary/extended? p                                     
File system type?  [ext2]? ext4                                          
Start? 2000M                                                             
End? 2013M                                                               
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

 1      1049kB  200MB   199MB   primary
 2      200MB   2000MB  1799MB  primary
 3      2000MB  2013MB  13.6MB  primary
Partition type?  [logical]? logical                                      
File system type?  [ext2]? ext4
Start? 2015M                                                             
End? 2200M                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                    
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags

 1      1049kB  200MB   199MB   primary
 2      200MB   2000MB  1799MB  primary
 3      2000MB  2013MB  13.6MB  primary
 4      2015MB  10.0GB  7985MB  extended               lba
 5      2015MB  2200MB  185MB   logical

(parted) rm 5     

(parted) quit

     

[root@server254 devices]# fdisk -l /dev/sdb

 

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 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: 0x000b6e12

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1          25      194560   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2              25         244     1757184   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sdb3             244         245       13312   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sdb4             246        1216     7797760    f  W95 Ext'd (LBA)