ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

CentOS7 磁盘管理

2019-07-09 14:51:10  阅读:679  来源: 互联网

标签:Disk sectors 管理 bytes dev CentOS7 磁盘 512 size


一、磁盘查看

查看所有磁盘

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

标签:Disk,sectors,管理,bytes,dev,CentOS7,磁盘,512,size
来源: https://www.cnblogs.com/jhxxb/p/11157315.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有