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

View Code

 

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

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

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

    # 保存分区
    w

    # 退出不保存
    q

 

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

 

  1. # 或 lsblk
  2. lsblk -f

 

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

 

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

 

  1. df -h

 

 


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

版权声明:本文为jhxxb原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/jhxxb/p/11157315.html