我添加一个新的虚拟硬盘驱动器vdb到KVM guest(centos6.5),像这样
[root@centos ~]# fdisk -l | grep vdb Disk /dev/vdb: 8589 MB, 8589934592 bytes
然后,有两种格式化磁盘的方法
一个。
[root@centos ~]# mkfs.ext4 /dev/vdb [root@centos ~]# mount /dev/vdb /data/
湾
[root@boss ~]# fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1044, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): Using default value 1044 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@centos ~]# mkfs.ext4 /dev/vdb1 [root@centos ~]# mount /dev/vdb1 /data/
以上两种方式工作正常,但有什么区别?
第一个命令是在整个磁盘上创build一个文件系统,不可能添加更多的分区。 第二个是分区磁盘,可以添加更多的分区(假设sdb1不使用整个磁盘)。