Linux 硬盘分区、格式化、挂载
1,切换硬盘
[root@ecs-299b-0001 ~]# fdisk /dev/vdb
2,根据提示进行操作
[root@bigboy tmp]# fdisk /dev/hdb
The number of cylinders for this disk is set to 9729.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Command (m for help): p// 2.1 输入p,查看该硬盘下是否已经有分区,如果没有,输入n ,添加分区。Command (m for help): nCommand actione extendedp primary partition (1-4)//2.2 输入p,创建一个主分区,硬盘大小默认回车,是硬盘的总大小,直接回车即可,如果有明确需求,可以自定义,然后选择创建几个分区。Command (m for help): pPartition number (1-4): 1// 2.3 最后输入'w'保存退出,输入q 不保存退出
3,格式化磁盘
mkfs.ext4 /dev/sdb1
4,分区挂载到目录下
mount /dev/sdb1 /home
5,编辑fstab文件:
vi /etc/fstab(这点十分重要,一定要记得编辑该文件,不然重启电脑后系统将不会保存之前的挂载操作)添加:dev/hdd1 /home ext3 defaults 1 1