一、磁盘查看

查看所有磁盘

  1. ll /dev/sd*

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

查看所有磁盘的分区情况

  1. fdisk -l

结果

  1. WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
  2.  
  3. Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
  4. Units = sectors of 1 * 512 = 512 bytes
  5. Sector size (logical/physical): 512 bytes / 512 bytes
  6. I/O size (minimum/optimal): 512 bytes / 512 bytes
  7. Disk label type: gpt
  8.  
  9. # Start End Size Type Name
  10. 1 2048 1953525134 931.5G unknown ceph data
  11. WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
  12.  
  13. Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
  14. Units = sectors of 1 * 512 = 512 bytes
  15. Sector size (logical/physical): 512 bytes / 512 bytes
  16. I/O size (minimum/optimal): 512 bytes / 512 bytes
  17. Disk label type: gpt
  18.  
  19. # Start End Size Type Name
  20. 1 2048 1953525134 931.5G unknown ceph data
  21.  
  22. Disk /dev/sda: 300.0 GB, 300000000000 bytes, 585937500 sectors
  23. Units = sectors of 1 * 512 = 512 bytes
  24. Sector size (logical/physical): 512 bytes / 512 bytes
  25. I/O size (minimum/optimal): 512 bytes / 512 bytes
  26. Disk label type: dos
  27. Disk identifier: 0x000de82e
  28.  
  29. Device Boot Start End Blocks Id System
  30. /dev/sda1 * 2048 1026047 512000 83 Linux
  31. /dev/sda2 1026048 585936895 292455424 8e Linux LVM
  32. WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
  33.  
  34. Disk /dev/sde: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
  35. Units = sectors of 1 * 512 = 512 bytes
  36. Sector size (logical/physical): 512 bytes / 512 bytes
  37. I/O size (minimum/optimal): 512 bytes / 512 bytes
  38. Disk label type: gpt
  39.  
  40. # Start End Size Type Name
  41. 1 2048 1953525134 931.5G unknown ceph data
  42. WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
  43.  
  44. Disk /dev/sdb: 300.0 GB, 300000000000 bytes, 585937500 sectors
  45. Units = sectors of 1 * 512 = 512 bytes
  46. Sector size (logical/physical): 512 bytes / 512 bytes
  47. I/O size (minimum/optimal): 512 bytes / 512 bytes
  48. Disk label type: gpt
  49.  
  50. # Start End Size Type Name
  51. 1 2048 62916607 30G unknown ceph journal
  52. 2 62916608 125831167 30G unknown ceph journal
  53. 3 125831168 188745727 30G unknown ceph journal
  54.  
  55. Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
  56. Units = sectors of 1 * 512 = 512 bytes
  57. Sector size (logical/physical): 512 bytes / 512 bytes
  58. I/O size (minimum/optimal): 512 bytes / 512 bytes
  59.  
  60. Disk /dev/mapper/centos-swap: 30.0 GB, 30001856512 bytes, 58597376 sectors
  61. Units = sectors of 1 * 512 = 512 bytes
  62. Sector size (logical/physical): 512 bytes / 512 bytes
  63. I/O size (minimum/optimal): 512 bytes / 512 bytes
  64.  
  65. Disk /dev/mapper/centos-home: 215.7 GB, 215721443328 bytes, 421330944 sectors
  66. Units = sectors of 1 * 512 = 512 bytes
  67. Sector size (logical/physical): 512 bytes / 512 bytes
  68. I/O size (minimum/optimal): 512 bytes / 512 bytes

二、磁盘分区

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

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

  1. # 对指定磁盘操作
  2. fdisk /dev/sdc
  3.  
  4. # 显示帮助
  5. m
  6.  
  7. # 显示已有分区
  8. p
  9.  
  10. # 删除分区,只有1个分区时,会自动删除已有分区,不用选择
  11. d
  12.  
  13. # 创建新的分区
  14. n
  15.  
  16. # 保存分区
    w
  17.  
  18. # 退出不保存
    q

三、磁盘格式化

  1. mkfs -t xfs -f /dev/sdb1

四、磁盘挂载

查看挂载情况

  1. # 或 lsblk
  2. lsblk -f

挂载已格式化的磁盘分区

  1. # 创建目录
  2. mkdir /home/data2
  3.  
  4. # 挂载磁盘到该目录
  5. mount /dev/sdd1 /home/data2/
  6.  
  7. # 卸载
  8. umount /dev/sdd1

开机自动挂载

  1. # 最后一行为新增挂载
  2. vim /etc/fstab
  3.  
  4. #
  5. # /etc/fstab
  6. # Created by anaconda on Fri May ::
  7. #
  8. # Accessible filesystems, by reference, are maintained under '/dev/disk'
  9. # See man pages fstab(), findfs(), mount() and/or blkid() for more info
  10. #
  11. /dev/mapper/centos-root / xfs defaults
  12. UUID=80774ba5-c734-40b3-90ec-5817bd434ce8 /boot xfs defaults
  13. /dev/mapper/centos-home /home xfs defaults
  14. /dev/mapper/centos-swap swap swap defaults
  15. /dev/sdc1 /home/data xfs defaults

五、已挂载磁盘查看

查看已挂载磁盘使用情况

  1. df -h

查看目录占用容量


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

CentOS7 磁盘管理的更多相关文章

  1. centos7 磁盘管理—— lvm的使用

    Linux用户安装Linux操作系统时遇到的一个常见的难以决定的问题就是如何正确地评估各分区大小,以分配合适的硬盘空间.普通的磁盘分区管理方式在逻辑分区划分好之后就无法改变其大小,当一个逻辑分区存放不 ...

  2. Linux的VMWare中Centos7磁盘分区管理 fdisk分区和制作文件系统格式化和开机自动挂载

    一.硬盘的组成零件扇区 磁道 磁盘容量 磁盘分区 简介 硬盘由容量.柱面数.磁头数.扇区数 C/H/S, Cylinder, Head, Sector(柱面/磁头数/扇区数) 1.磁头数表示硬盘总共有 ...

  3. centOS7服务管理与启动流程

    centOS7服务管理与启动流程 centOS7启动流程 systemd简介 unit对象 unit类型 特性 service unit文件格式 service unit file文件通常由三部分组成 ...

  4. 磁盘管理 之 parted命令添加swap,文件系统

    第1章 磁盘管理 1.1 必须要了解的. 1.1.1 ps aux 命令中 RSS 与VSZ的含义 rss 进程占用的物理内存的大小 单位:kb : vsz 进程占用的虚拟的内存大小(物理内存+swa ...

  5. linux磁盘管理系列-软RAID的实现

    1 什么是RAID RAID全称是独立磁盘冗余阵列(Redundant Array of Independent Disks),基本思想是把多个磁盘组合起来,组合一个磁盘阵列组,使得性能大幅提高. R ...

  6. linux磁盘管理系列-LVM的使用

    LVM是什么 LVM是Linux操作系统的逻辑卷管理器. 现在有两个Linux版本的LVM,分别是 LVM1,LVM2.LVM1是一种已经被认为稳定了几年的成熟产品,LVM2 是最新最好的LVM版本. ...

  7. linux 磁盘管理三部曲——(2)管理分区,文件系统类型格式化

    上篇小编给大家讲解了磁盘结构和分区的介绍,这篇小编就给大家演示如何管理分区和文件系统类型格式化. 小编上篇已经提到如何使用磁盘,今天这两步,就是其中很重要的两步.(前几天写的有点急,有点乱,今天又整理 ...

  8. linux磁盘管理系列三:LVM的使用

    磁盘管理系列 linux磁盘管理系列一:磁盘配额管理   http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...

  9. linux磁盘管理系列二:软RAID的实现

    磁盘管理系列 linux磁盘管理系列一:磁盘配额管理   http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...

随机推荐

  1. http协议:http请求、http响应、间隔时间跳转页面、禁用浏览器缓存

    转自:https://blog.csdn.net/u013372487/article/details/46991623 http协议 1. http协议是建立在  tcp/ip协议基础上. 2. 我 ...

  2. 输出指令(echo指令和printf 命令)

    Shell echo命令 Shell 的 echo 指令与 PHP 的 echo 指令类似,都是用于字符串的输出.命令格式: echo string 您可以使用echo实现更复杂的输出格式控制. 1. ...

  3. 第十章、typing模块

    目录 第十章.typing模块 一.说明 二.typing模块的作用 三.使用typing模块 四.typing常用类型 第十章.typing模块 一.说明 二.typing模块的作用 类型检查,防止 ...

  4. linux 网卡相关命令

    1. ifconfig //查看网络相关信息 2. ifconfig eth0 192.168.1.103 netmask 255.255.255.0 //配置eth0的IP地址 3. route - ...

  5. Galera Cluster 实现mysql的高可用 (Percona XtraDB Cluster)

    Galera Cluster 实现mysql的高可用 (Percona XtraDB Cluster) # 基础搭建 # 设备:三台主机 192.168.47.101 192.168.47.102 1 ...

  6. linux下安装google-chrome浏览器和chromedriver

    1.root用户下进入到etc/yum.repos.d目录下 [root@f7d6b9f2-1291-4d2f-8805-aef94deac9f7 yum.repos.d]# pwd cd /etc/ ...

  7. Linux :ssh sftp scp

    SSH 概述 1 SSH协议,Secure Shell ,为客户提供安全的shel环境,默认端口22 OpenSSH服务 服务名称:sshd 主程序:/usr/bin/sshd    /usr/bin ...

  8. 23_2spring的常用注解

    1.基于注解的IOC配置 1.1导入jar包 <?xml version="1.0" encoding="UTF-8"?> <project ...

  9. VMware提示此主机支持Intel VT-x,但Intel VT-x处于禁用状态怎么解决

    本文链接:https://blog.csdn.net/weixin_40816738/article/details/90146770 ThinkPad笔记本1.开机按F1或Fn+F1进入BIOS,切 ...

  10. P3806 离线多次询问 树上距离为K的点对是否存在 点分治

    询问树上距离为k的点对是否存在 直接n^2暴力处理点对 桶排记录 可以过 #include<cstdio> #include<cstring> #include<algo ...