CentOS7 磁盘管理

匿名 (未验证) 提交于 2019-12-02 23:47:01

一、磁盘查看

查看所有磁盘

ll /dev/sd*

不带数字的为磁盘,带数字的为磁盘的分区

 

查看所有磁盘的分区情况

fdisk -l

结果

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.  Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 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: gpt   #         Start          End    Size  Type            Name  1         2048   1953525134  931.5G  unknown         ceph data WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.  Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 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: gpt   #         Start          End    Size  Type            Name  1         2048   1953525134  931.5G  unknown         ceph data  Disk /dev/sda: 300.0 GB, 300000000000 bytes, 585937500 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: 0x000de82e     Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048     1026047      512000   83  Linux /dev/sda2         1026048   585936895   292455424   8e  Linux LVM WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.  Disk /dev/sde: 1000.2 GB, 1000204886016 bytes, 1953525168 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: gpt   #         Start          End    Size  Type            Name  1         2048   1953525134  931.5G  unknown         ceph data WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.  Disk /dev/sdb: 300.0 GB, 300000000000 bytes, 585937500 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: gpt   #         Start          End    Size  Type            Name  1         2048     62916607     30G  unknown         ceph journal  2     62916608    125831167     30G  unknown         ceph journal  3    125831168    188745727     30G  unknown         ceph journal  Disk /dev/mapper/centos-root: 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 /dev/mapper/centos-swap: 30.0 GB, 30001856512 bytes, 58597376 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 /dev/mapper/centos-home: 215.7 GB, 215721443328 bytes, 421330944 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
View Code

 

二、磁盘分区

连接磁盘硬件 -> 对磁盘分区 -> 对分区进行格式化 -> 挂载分区到目录 -> 使用

https://blog.51cto.com/yueyue207/2072255

# 对指定磁盘操作 fdisk /dev/sdc  # 显示帮助 m  # 显示已有分区 p  # 删除分区,只有1个分区时,会自动删除已有分区,不用选择 d  # 创建新的分区 n

 

三、磁盘挂载

查看挂载情况

# 或 lsblk lsblk -f

 

挂载已格式化的磁盘分区

# 创建目录 mkdir /home/data2  # 挂载磁盘到该目录 mount /dev/sdd1 /home/data2/  # 卸载 umount /dev/sdd1

 

开机自动挂载

# 最后一行为新增挂载 vim /etc/fstab  # # /etc/fstab # Created by anaconda on Fri May 17 02:12:54 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/centos-root /                       xfs     defaults        0 0 UUID=80774ba5-c734-40b3-90ec-5817bd434ce8 /boot xfs     defaults        0 0 /dev/mapper/centos-home /home                   xfs     defaults        0 0 /dev/mapper/centos-swap swap                    swap    defaults        0 0 /dev/sdc1 /home/data                            xfs     defaults        0 0

 

四、已挂载磁盘查看

查看已挂载磁盘使用情况

df -h

 

查看目录占用容量

 


https://blog.csdn.net/qq_30604989/article/details/81163270

转载请标明出处:CentOS7 磁盘管理
文章来源: CentOS7 磁盘管理
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!