CentOS7 磁盘管理
2024-09-02 07:58:31
一、磁盘查看
查看所有磁盘
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
二、磁盘分区
连接磁盘硬件 -> 对磁盘分区 -> 对分区进行格式化 -> 挂载分区到目录 -> 使用
https://blog.51cto.com/yueyue207/2072255
# 对指定磁盘操作
fdisk /dev/sdc # 显示帮助
m # 显示已有分区
p # 删除分区,只有1个分区时,会自动删除已有分区,不用选择
d # 创建新的分区
n # 保存分区
w # 退出不保存
q
三、磁盘格式化
mkfs -t xfs -f /dev/sdb1
四、磁盘挂载
查看挂载情况
# 或 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 ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
/dev/mapper/centos-root / xfs defaults
UUID=80774ba5-c734-40b3-90ec-5817bd434ce8 /boot xfs defaults
/dev/mapper/centos-home /home xfs defaults
/dev/mapper/centos-swap swap swap defaults
/dev/sdc1 /home/data xfs defaults
五、已挂载磁盘查看
查看已挂载磁盘使用情况
df -h
查看目录占用容量
https://blog.csdn.net/qq_30604989/article/details/81163270
最新文章
- 每天一个linux命令(48):watch命令
- Join的表顺序
- The server does not support version 3.0 of the J2EE Web module specification
- 事件委托和this
- IntelliJ IDEA 集成Tomcat后找不到HttpServlet问题(2015年06月13日)
- BZOJ 1072 [SCOI2007]排列perm
- JQ each
- Android SQLiteDatabase使用总结
- HTML 笔记 基础1
- 【转载】CSS3 filter:drop-shadow滤镜与box-shadow区别应用
- 零代码第一步,做个添加数据的服务先。node.js + mysql
- python面试终极准备
- Java开发笔记(六十五)集合:HashSet和TreeSet
- cdnbest获取,删除,增加,修改域名列表,高级设置api示例
- 跨浏览器的javascript事件的封装
- github作业
- filter和map的区别
- 在虚拟机里安装linux(centos 6.5)系统
- python基础之while语句continue以及break --语法以及案例
- MyBatis-Plus 3.0.7.1
热门文章
- 云端js动态效果
- 阿里云环境中配置tomcat7可能出现的问题及解决方法
- zookeeper配置文件说明
- Joomla 3.0.0 - 3.4.6 RCE漏洞分析记录
- Oracle 触发器学习笔记一
- Docker容器入门篇
- “联邦对抗技术大赛”9月开战 微众银行呼唤开发者共同“AI创新”
- 11步教你选择最稳定的MySQL版本
- Python 判断文件是否存在,不存在则将名称写入指定文件
- [学习笔记] 可持久化线段树&;主席树