硬盘添加完需要重启
[root@oldboyedu01 ~]# fdisk -cu[XM1] /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3cbc19d7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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 ##删除分区
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)
e extended ##扩展分区 (主分区和扩展分区 1-4)
p primary partition (1-4) ##主分区
[XM1]-c 关闭dos兼容模式 u是按照扇区进行磁盘分区
第二步:
[root@oldboyedu01 ~]# partprobe /dev/sdb 通知系统磁盘变化
第三步:
[root@oldboyedu01 ~]# mkfs.ext4 /dev/sdb1 ##格式化创建文件系统
mkfs.ext4 ====mkfs -t ext4
第四步. 关闭磁盘分区自动检查
[root@oldboyedu01 ~]# tune2fs -c 0 -i 0 /dev/sdb[XM1] 1
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
第五步. [root@oldboyedu01 ~]# mount /dev/sdb1 /mnt/ ##手动挂载
[root@oldboyedu01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 1.7G 17G 10% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 190M 76M 105M 42% /boot
/dev/sdb1 34M 482K 32M 2% /mnt
[XM1]-c 0 #关闭每挂载多少次进行磁盘检查的功能
-i 0 #关闭每180天进行磁盘检查功能
进行开机自动永久挂载
第一种
#1. /etc/rc.local
/bin/mount /dev/sdb1 /mnt/
第二种
#2. /etc/fstab
UUID=02f5c542-db3e-497e-8f36-9cffa0c7f25a / ext4 defaults 1 1
UUID=f80cb2b9-2f1b-41b4-bb9c-15dc1af35934 /boot ext4 defaults 1 2
UUID=eb14e512-86cc-4634-8f60-c782d04118ca swap swap defaults[XM1] 0[XM2] 0[XM3]
1.设备或磁盘的名称 2.挂载点 3.文件系统的类型
/dev/sdb1 /mnt ext4 defaults 0 0
[root@oldboyedu01 ~]# umount /mnt