[root@ziluopao ~]# fdisk /dev/sdb //分区命令对磁盘进行初使化
[root@ziluopao ~]# mke2fs -j /dev/sdb1 //创建ext2文件系统
[root@ziluopao ~]# mke2fs /dev/sdb1/ //创建硬盘系统相当于格式化
[root@ziluopao ~]# e2fsck -p /dev/sdb1 //磁盘修复e2fsck命令,通过此命令可以在使用磁盘前,修改 一下磁盘,以防数据损坏
[root@ziluopao ~]# tune2fs -c 60 /dev/sdb1 //改变挂载多少次检测磁盘
[root@ziluopao ~]# tune2fs -i 70d /dev/sdb1 //改变挂载多少天开始检测磁盘
[root@ziluopao ~]# e2label /dev/sdb1 www-data //指定卷标
[root@ziluopao ~]# tune2fs -l /dev/sdb1 //查看卷标的方法
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name: www-data
[root@ziluopao ~]# findfs LABEL=www-data //查找卷标
/dev/sdb1
手工挂载磁盘
#
# /etc/fstab
# Created by anaconda on Sat Oct 21 19:11:54 2017
#
# Accessible filesystems,by reference,are maintained under '/dev/disk'
# See man pages fstab(5),findfs(8),mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_ziluopao-lv_root / ext4 defaults 1 1
UUID=9e5c747b-1f45-45dd-a7e2-44674ee9b558 /boot ext4 defaults 1 2
/dev/mapper/vg_ziluopao-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /opt ext4 defaults 1 1
~
[root@ziluopao ~]# mount -a //此命令是在修改上面表的挂载后让其生效的作用
然后看是否挂载成功,使用如下命令mount 或fdisk -l
[root@ziluopao ~]# df -h //通过此命令查看当前命令的使用情况
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_ziluopao-lv_root
8.3G 761M 7.1G 10% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 477M 28M 425M 7% /boot
/dev/sdb1 /dev/sdb1 20G 45M 19G 1% /opt
卸载磁盘命令:
[root@ziluopao ~]# umount /opt
移动硬盘挂载命令:
[root@ziluopao /]# mount -t ext3
挂载光驱流程
[root@ziluopao /]# cd media
[root@ziluopao media]# ls
[root@ziluopao media]# mkdir cdrom
[root@ziluopao media]# ls
cdrom
[root@ziluopao media]# cd /
[root@ziluopao /]# mount media/cdrom
mount: can't find media/cdrom in /etc/fstab or /etc/mtab
[root@ziluopao /]#
注意上面光驱挂载还要在挂载表中写好
挂载ISO文件
[root@ziluopao dev]# cd /home
[root@ziluopao home]# ls
CentOS-6.6-x86_64-minimal.iso
[root@ziluopao home]# cd /media/
[root@ziluopao media]# ls
cdrom
[root@ziluopao media]# mkdir iso
[root@ziluopao media]# mount -o loop /home/CentOS-6.6-x86_64-minimal.iso /media/iso [root@ziluopao media]#