首页 > 其他分享 >CentoOS磁盘挂载

CentoOS磁盘挂载

时间:2022-11-28 20:13:01浏览次数:46  
标签:CentoOS sectors 16G bytes dev 磁盘 挂载 512 size

查看磁盘个数

fdisk -l

Disk /dev/vda: 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 label type: dos
Disk identifier: 0x000bcf72

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     2099199     1048576   83  Linux
/dev/vda2         2099200   104857599    51379200   8e  Linux LVM

Disk /dev/vdb: 1073.7 GB, 1073741824000 bytes, 2097152000 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-root: 50.5 GB, 50457477120 bytes, 98549760 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: 2147 MB, 2147483648 bytes, 4194304 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

df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  16G     0   16G   0% /dev
tmpfs                     16G     0   16G   0% /dev/shm
tmpfs                     16G   26M   16G   1% /run
tmpfs                     16G     0   16G   0% /sys/fs/cgroup
/dev/mapper/centos-root   47G  9.2G   38G  20% /
/dev/vda1               1014M  217M  798M  22% /boot
tmpfs                    3.2G     0  3.2G   0% /run/user/0

可以看到,还有一块/dev/vdb的磁盘尚未挂载,对该盘符进行挂载

格式化盘符

磁盘分区

# 进入fdisk模式,开始对新增数据盘执行分区操作
# 操作前务必确定磁盘可以格式化,若已有数据会全部抹除!!!
# 操作前务必确定磁盘可以格式化,若已有数据会全部抹除!!!
# 操作前务必确定磁盘可以格式化,若已有数据会全部抹除!!!
fdisk /dev/vdb  
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xe7ad60ad.

Command (m for help): 
# 在上述回执中输入n,开始磁盘分区,后续操作一路default即可。
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-2097151999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151999, default 2097151999):
Using default value 2097151999
Partition 1 of type Linux and of size 1000 GiB is set

Command (m for help):
# 此时输入w,将分区信息写入磁盘
# 如回显信息如下,则说明分区成功:
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

设置磁盘格式化格式

# 查看现有磁盘格式
df -hT
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs   16G     0   16G   0% /dev
tmpfs                   tmpfs      16G     0   16G   0% /dev/shm
tmpfs                   tmpfs      16G   26M   16G   1% /run
tmpfs                   tmpfs      16G     0   16G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        47G  9.1G   38G  20% /
/dev/vda1               xfs      1014M  217M  798M  22% /boot
tmpfs                   tmpfs     3.2G     0  3.2G   0% /run/user/0
# 可以看到/dev/vda1的磁盘格式为xfs,将新挂载磁盘格式也设置为xfs
# 查看磁盘信息
fdisk -l
Disk /dev/vda: 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 label type: dos
Disk identifier: 0x000bcf72

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     2099199     1048576   83  Linux
/dev/vda2         2099200   104857599    51379200   8e  Linux LVM

Disk /dev/vdb: 1073.7 GB, 1073741824000 bytes, 2097152000 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: 0xe7ad60ad

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048  2097151999  1048574976   83  Linux

Disk /dev/mapper/centos-root: 50.5 GB, 50457477120 bytes, 98549760 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: 2147 MB, 2147483648 bytes, 4194304 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
# 可以看到新磁盘下多了/dev/vdb1分区
# 设置待挂载磁盘格式
mkfs -t xfs /dev/vdb1
# 回显如下
meta-data=/dev/vdb1              isize=512    agcount=4, agsize=65535936 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=262143744, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=127999, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

挂载磁盘

# 创建待挂载目录
mkdir /data
# 执行挂载
mount /dev/vdb1 /data

标签:CentoOS,sectors,16G,bytes,dev,磁盘,挂载,512,size
From: https://www.cnblogs.com/jason1990/p/16933467.html

相关文章

  • Linux中的磁盘管理
    目录​​目录​​​​磁盘管理命令​​​​向服务器添加硬盘​​​磁盘分区​​​分区模式之MBR分区​​​​分区模式之GPT分区​​​分区操作​​​Linux中的MBR分区​​​......
  • 在某一磁盘目录下将.txt的所有文件遍历打印到控制台上
    packagetest.haofa;//用java语言编写,在某一磁盘目录下将.txt的所有文件遍历打印到控制台上importjava.io.File;importjavax.swing.JOptionPane;publicclassDemoFile{p......
  • VMware虚拟机CentOS 7 磁盘扩容
    一、环境虚拟机软件:VMware14系统版本:CentOS 7二、扩容步骤1、VM上修改磁盘信息将虚拟机关机,然后点击VM顶部菜单栏中的显示或隐藏控制台视图按钮来显示已建立的虚拟机......
  • linux磁盘占用100%,却找不到大文件——记一次僵尸文件导致的服务异常
    问题:  因服务器磁盘占用100%而导致服务异常。解决:  先用命令检查磁盘df-h[root@localhost/]#df-h文件系统容量已用可用已用%挂载点/d......
  • Linux基于大于2TB磁盘挂载
    Linux基于大于2TB磁盘挂载首先查看服务器磁盘,这里将LINUX系统安装在sda,应用程序用于存放在sdb[root@voices-bak~]#fdisk-lDisk/dev/sda:127.0GB,126999330816by......
  • Linux 卸载磁盘target is busy
    一、简介问题:umount/dev/sdxx命令时可能会报"deviceisbusy",这个合理的报错可以防止正在使用的设备上的数据丢失。如1)使用者自己清楚确实发生了错误2)使用者不在乎数据......
  • win server 磁盘io查询方法
           ......
  • CentOS 中利用逻辑卷挂载某个目录以及扩容
    挂载假设当前挂载点只有root,即/,现在要将home文件夹单独挂载到一个逻辑卷中:#假设虚拟机中已经新建硬盘pvs#查看新硬盘名称,假设为/dev/sdb1,容量为10Gfdisk-l......
  • Linux 查看磁盘空间
    linux查看磁盘空间可以使用df和du命令。dfdf以磁盘分区为单位查看文件系统,可以获取硬盘被占用了多少空间,目前还剩下多少空间等信息。例如,我们使用df-h命令来查看......
  • centos7配置autofs自动挂载nfs
    本篇介绍在centos7.9系统中安装autofs自动挂载nfs集群已经部署完成了nfs服务,其导出的共享目录地址为:192.168.80.187:/home/export/base,需求是在node17里面当用户登陆时,自......