①使用lsblk -f命令查看新添加的硬盘sdb
[root@node04 ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
sda
├─sda1 ext4 f901db3e-cf38-4899-8dc2-190e9884df6f /boot
└─sda2 LVM2_member DSNFIu-ptjm-Eny8-lMW5-Wk10-V5o3-ZdP1E7
├─vg_node04-lv_root (dm-0)
ext4 64b53586-dedb-42aa-b8d9-bd5d8976f256 /
└─vg_node04-lv_swap (dm-1)
swap 2e9bca3d-3412-4d92-a015-620399bbab76 [SWAP]
sr0 iso9660 CentOS_6.9_Final
②使用fdisk对硬盘分区,并将其格式化为ext4
[root@node04 ~]# fdisk /dev/sdb
[root@node04 ~]# mkfs -t ext4 /dev/sdb1
③查看硬盘UUID,修改fstab文件
[root@node04 ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
└─sdb1 ext4 89b8893b-eca5-474f-91c0-d59eaddb7325
sda
├─sda1 ext4 f901db3e-cf38-4899-8dc2-190e9884df6f /boot
└─sda2 LVM2_member DSNFIu-ptjm-Eny8-lMW5-Wk10-V5o3-ZdP1E7
├─vg_node04-lv_root (dm-0) ext4 64b53586-dedb-42aa-b8d9-bd5d8976f256 /
└─vg_node04-lv_swap (dm-1) swap 2e9bca3d-3412-4d92-a015-620399bbab76 [SWAP]
sr0 iso9660 CentOS_6.9_Final
修改/etc/fstab文件
#
# /etc/fstab
# Created by anaconda on Wed Oct 30 04:03:35 2019
#
# 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_node04-lv_root / ext4 defaults 1 1
UUID=f901db3e-cf38-4899-8dc2-190e9884df6f /boot ext4 defaults 1 2
UUID=89b8893b-eca5-474f-91c0-d59eaddb7325 /mnt/disk01 ext4 defaults 1 2
/dev/mapper/vg_node04-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
重启
注:如fstab修改错误致使系统无法启动,提示
give root password for maintenance
(or type control-d to continue:)
输入root 密码进入系统了后文件不能修改
mount -o remount, rw /
使用这条命令让/路径文件系统为可读模式,随后即可修改
文章评论