天天看点

fdisk创建分区

1.查看分区表

[root@server8 ~]# cat /proc/partitions  

major minor  #blocks  name 

 252        0    8388608 vda 

 252        1     512000 vda1 

 252        2    7875584 vda2 

 252       16    5242880 vdb 

 252       17     204800 vdb1 

 253        0    6856704 dm-0 

 253        1    1015808 dm-1 

 253        2     202752 dm-2 

查看vdb

[root@server8 ~]# fdisk -cul /dev/vdb 

Disk /dev/vdb: 5368 MB, 5368709120 bytes 

7 heads, 6 sectors/track, 249660 cylinders, total 10485760 sectors 

Units = sectors of 1 * 512 = 512 bytes 

Sector size (logical/physical): 512 bytes / 512 bytes 

I/O size (minimum/optimal): 512 bytes / 512 bytes 

Disk identifier: 0x748cfa01 

   Device Boot      Start         End      Blocks   Id  System 

/dev/vdb1            2048      411647      204800   83  Linux 

[root@server8 ~]# fdisk -cu /dev/vdb 

Command (m for help): n 

Command action 

   e   extended 

   p   primary partition (1-4) 

Partition number (1-4): 2 

First sector (411648-10485759, default 411648):  

Using default value 411648 

Last sector, +sectors or +size{K,M,G} (411648-10485759, default 10485759): +200M 

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: Device or resource busy. 

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@server8 ~]# init 6 

 252       18     204800 vdb2 

mkdir /test 

[root@server8 ~]# vi /etc/fstab 

/dev/vdb2  /test  ext4 defaults  0 0 

本文转自 369蓝宝 51CTO博客,原文链接:http://blog.51cto.com/3739387/1128409,如需转载请自行联系原作者

继续阅读