问题
发现腾讯云控制台一个服务器挂载了一个数据库,但是用df -h查看磁盘占用情况,发现磁盘/dev/vdb1消失了。是磁盘坏了?还是没被系统识别?
df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 24K 3.9G 1% /dev/shm tmpfs 3.9G 540K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 50G 9.9G 38G 21% / tmpfs 783M 0 783M 0% /run/user/1001 tmpfs 783M 0 783M 0% /run/user/0
解决
用命令fdisk -l查看新磁盘是否被系统识别
fdisk -l Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009ac89 Device Boot Start End Blocks Id System /dev/vda1 * 2048 104857566 52427759+ 83 Linux Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x59c02e2c Device Boot Start End Blocks Id System /dev/vdb1 2048 209715199 104856576 83 Linux
可见vdb1是存在的,只需要mount就好。
新建一个文件夹,作为将来访问vdb1的标识
mkdir /data1
查看磁盘vda的文件系统类型
df -T Filesystem Type 1K-blocks Used Available Use% Mounted on devtmpfs devtmpfs 3993424 0 3993424 0% /dev tmpfs tmpfs 4004344 24 4004320 1% /dev/shm tmpfs tmpfs 4004344 560 4003784 1% /run tmpfs tmpfs 4004344 0 4004344 0% /sys/fs/cgroup /dev/vda1 ext4 51473868 10103044 39173580 21% / tmpfs tmpfs 800872 0 800872 0% /run/user/1001 tmpfs tmpfs 800872 0 800872 0% /run/user/0
挂载磁盘vdb1到data1
mount -t ext4 /dev/vdb1 /data1/
用df -h可以查看到新挂载上的磁盘vdb1
今后访问/data1,就相当于访问磁盘vdb1。
总结
跟磁盘相关的几个常用命令:
df -h:查看磁盘占用情况 df -T:查看所有磁盘的文件系统类型(type) fdisk -l:查看所有被系统识别的磁盘 mount -t type device dir:挂载device到dir
- 本文固定链接: https://www.phpmianshi.com/?id=262
- 转载请注明: admin 于 PHP面试网 发表
《本文》有 0 条评论