bingooyong / note

1 stars 1 forks source link

挂载SSD #24

Open bingooyong opened 5 years ago

bingooyong commented 5 years ago

检查磁盘情况

发现sdbsdc是新插入的SSD磁盘,还没有挂载使用

[root@fs03 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   1.8T  0 disk
├─sda1            8:1    0   200M  0 part /boot/efi
├─sda2            8:2    0     1G  0 part /boot
└─sda3            8:3    0   1.8T  0 part
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0  31.4G  0 lvm
  └─centos-home 253:2    0   1.8T  0 lvm  /home
sdb               8:16   0 894.3G  0 disk
sdc               8:32   0 894.3G  0 disk

格式化

[root@fs03 ~]# mkfs.ext4 /dev/sdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb is entire device, not just one partition!
无论如何也要继续? (y,n) y
Discarding device blocks: 完成
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
58613760 inodes, 234423126 blocks
11721156 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2382364672
7155 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000, 214990848

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

[root@fs03 ~]# mkfs.ext4 /dev/sdc
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdc is entire device, not just one partition!
无论如何也要继续? (y,n) y
Discarding device blocks: 完成
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
58613760 inodes, 234423126 blocks
11721156 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2382364672
7155 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000, 214990848

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

挂载

[root@fs03 ~]# mkdir /opt/ssd1
[root@fs03 ~]# mkdir /opt/ssd2
[root@fs03 ~]# mount /dev/sdb /opt/ssd1
[root@fs03 ~]# mount /dev/sdc /opt/ssd2

检查

2块磁盘已经挂载上了

[root@fs03 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   1.8T  0 disk
├─sda1            8:1    0   200M  0 part /boot/efi
├─sda2            8:2    0     1G  0 part /boot
└─sda3            8:3    0   1.8T  0 part
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0  31.4G  0 lvm
  └─centos-home 253:2    0   1.8T  0 lvm  /home
sdb               8:16   0 894.3G  0 disk /opt/ssd1
sdc               8:32   0 894.3G  0 disk /opt/ssd2

自动挂载

重启之后发现上次的挂载信息失效了,这个时候需要修改配置文件,让它开机的时候自动挂载。 修改/etc/fstab文件,文件末尾添加

/dev/sdb /opt/ssd1 ext4 defaults 0 0
/dev/sdc /opt/ssd2 ext4 defaults 0 0

授予权限

新挂载的目录可能权限比较低,可以更改为更高的权限。

重启检查

使用如下命令,优雅的重启系统

init 6