fdisk磁盘分区工具
[root@k8s-master01 ~]# fdisk /dev/hdd #这里假如有一块hdd磁盘需要分区 Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x3ebcddad. Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table 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)
例子:
[root@localhost ~]# fdisk /dev/hdd 按"p"键打印分区表 这块硬磁尚未分区 按"n"键新建一个分区。 出现两个菜单e表示扩展分区,p表示主分区 按"p"键出现提示:"Partition number (1-4): "选择主分区号 输入"1"表示第一个主分区。 直接按回车表示1柱面开始分区。 提示最后一个柱面或大小。 输入+5620M 按回车 表示第一个分区为5G空间。 按"p"查看一下分区 这样一个主分区就分好了。 接下来分第二个主分区,把剩余空间都给第二个主分区。 按"n" 键新增一个分区 按"p"键设为主分区 输入"2"把主分区编号设为2 按两下回车把剩余空间分给第二个主分区。 按"p"键打印分区表 按"w"键保存退出。 读者可根据自己的硬盘大小来划分合适的分区。 4、使用分区 在使用硬盘之前必须对其分区进行格式化,并挂载。 [root@localhost ~]#mkfs.ext3 /dev/hdd1 [root@localhost ~]#mkfs.ext3 /dev/hdd2 创建挂载目录 [root@localhost ~]#mkdir /hdd1 /hdd2 挂载/dev/hdd1 /dev/hdd2 [root@localhost ~]#mount /dev/hdd1 /hdd1 [root@localhost ~]#mount /dev/hdd2 /hdd2 查看 [root@localhost ~]#df -h
mkfs 格式化分区
将sda6分区格式化为ext3格式
mkfs -t ext3 /dev/sda6
注意:这里的文件系统是要指定的,比如 ext3 ;reiserfs ;ext2 ;fat32 ;msdos 等。
浙公网安备 33010602011771号