1. df -h

Disk label type 值为dos表示MBR分区,值为gpt表示GPT分区。

[root@iZuf66gcq71y5hlfv02w6aZ ~]# yum install -y parted

[root@iZuf66gcq71y5hlfv02w6aZ ~]# yum install -y e2fsprogs

其中:

  • /dev/vdb1:已创建好文件系统的数据盘分区,您需要根据实际情况修改对应的分区名称。
  • /opt:挂载(mount)的目录节点,您需要根据实际情况修改。 /opt 不能改成 / 或已有盘符,这样就会和vda抢占根目录,这样的话会直接导致服务器崩溃,因为数据都在vda1那里
  • ext4:分区的文件系统类型,您需要根据创建的文件系统类型修改。
[root@iZuf66gcq71y5hlfv02w6aZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 652K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda1 40G 3.4G 35G 9% /
tmpfs 783M 0 783M 0% /run/user/0
[root@iZuf66gcq71y5hlfv02w6aZ ~]# fdisk -l Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000c7bcb Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886046 41941999+ 83 Linux Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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 [root@iZuf66gcq71y5hlfv02w6aZ ~]# 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 0x5181edbf. Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZuf66gcq71y5hlfv02w6aZ ~]# fdisk -lu /dev/vdb Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0x5181edbf Device Boot Start End Blocks Id System
/dev/vdb1 2048 209715199 104856576 83 Linux
[root@iZuf66gcq71y5hlfv02w6aZ ~]# mkfs -t ext4 /dev/vdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214144 blocks
1310707 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2174746624
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done [root@iZuf66gcq71y5hlfv02w6aZ ~]# mkfs -t xfs /dev/vdb1
mkfs.xfs: /dev/vdb1 appears to contain an existing filesystem (ext4).
mkfs.xfs: Use the -f option to force overwrite.
[root@iZuf66gcq71y5hlfv02w6aZ ~]# cp /etc/fstab /etc/fstab.bak
[root@iZuf66gcq71y5hlfv02w6aZ ~]# echo `blkid /dev/vdb1 | awk '{print $2}' | sed 's/\"//g'` /opt ext4 defaults 0 0 >> /etc/fstab
[root@iZuf66gcq71y5hlfv02w6aZ ~]# cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Tue Feb 8 06:52:06 2022
#
# 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
#
UUID=42616xxxxxxxxxxxxxxxxxxxxxxxxxd9e935 / ext4 defaults 1 1
UUID=5d371xxxxxxxxxxxxxxxxxxxxxxxxxx12055 /opt ext4 defaults 0 0
[root@iZuf66gcq71y5hlfv02w6aZ ~]# mount -a
[root@iZuf66gcq71y5hlfv02w6aZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 692K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda1 40G 3.4G 35G 9% /
tmpfs 783M 0 783M 0% /run/user/0
/dev/vdb1 99G 61M 94G 1% /opt
[root@iZuf66gcq71y5hlfv02w6aZ ~]#
 [root@iZuf66gcq71y5hlfv02w6aZ ~]# mount -o remount,rw /

不执行 mount -o remount,rw / 可能会报   【Unable to create tempDir. java.io.tmpdir is set to /tmp

https://help.aliyun.com/document_detail/25426.html#section-wq3-ius-0f0

阿里云CentOS数据盘挂载(磁盘扩容)的更多相关文章

  1. 阿里云ECS 实例Centos7系统磁盘扩容

    需求:一台阿里云的数据盘磁盘空间不足,需要扩容,我这里只有一个主分区,ext4文件系统. 因为磁盘扩容场景不同,阿里云的文档比较全面一些,所以先奉上阿里云的文档,下面开始我的操作步骤: 1.登录控制台 ...

  2. 阿里云ECSLinux系统下挂载磁盘

    最近公司服务器老是提示磁盘空间不足,原因是以前的业务负责人开了Tomcat的debug日志并且没有做日志轮询,所以日志量非常大.当我做了日志切割轮询后发现磁盘还是太小才40G,按理外网服务器怎么可能这 ...

  3. 阿里云CentOS 7服务器挂载数据盘

    本次使用的是centOS 7.4 64位操作系统 第一步:查看磁盘情况 我们发现,我总共有三个磁盘,分别为/dev/vda(100G)./dev/vdb(200G)./dev/vdc(100G),而被 ...

  4. 阿里云CentOS 7系统挂载SSD云盘的教程_Linux

    一.查看SSD云盘 sudo fdisk -l Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors ...

  5. 阿里云CENTOS服务器挂载数据盘

    阿里云Linux云服务器数据盘默认是未做分区和格式化的,使用前需要先挂载数据盘.步骤如下: 1.查看数据盘 在没有分区之前,使用   1 df -h 2.命令,是无法查看到数据盘的,可以使用   1 ...

  6. 阿里云Linux服务器,挂载硬盘并将系统盘数据迁移到数据盘

    因为之前用宝塔上线,宝塔只挂载了系统盘50G,打开阿里云云盘列表发现系统盘无法直接升级,故另买一块数据盘挂载到Linux服务器下,下面根据网上教程再结合我实际情况讲解一下实际操作,其实非常easy l ...

  7. CentOS系统下的数据盘挂载

    此教程适用系统:Linux(CentOS,Debian,Ubuntu,Fedora) 通常新开通的Linux云服务器数据盘都未做分区和格式化.在进行数据盘挂载之前我们要先进行分区以及格式化操作.注意, ...

  8. 阿里云Linux格式化数据盘,分区并挂载一个文件系统

    阿里云一块全新的数据盘挂载到ECS实例后,您必须创建并挂载至少一个文件系统.本示例使用I/O优化实例,操作系统为CentOS 7.6,为一块新的300GiB数据盘(设备名为/dev/vdb)创建一个M ...

  9. 阿里云-CentOS如何挂载硬盘

    阿里云CentOS挂载硬盘 查看当前未挂载的硬盘 # fdisk -l 创建硬盘分区 # fdisk /dev/vdb 根据提示,依次输入"n","p" &qu ...

  10. linux系统数据盘挂载教程

    将数据盘挂载为/www命令:#mkdir /www & mount /dev/sdb1 /www ----------------------------------------------- ...

随机推荐

  1. Typora + PicGo 快乐书写 Markdown 文档

    声明 以下提及的图床服务商跟本人无任何商业来往,你可以根据自己的需要选择其他更适合的服务商. 个人观点 这是一个服务付费的时代,相比于自己折腾.在价格适当,服务到位的情况下,我更倾向于选择商业服务.毕 ...

  2. SMC

    记一次入门反调试技术 找到关键函数,先分析F5伪代码,发现了virtualprotect函数,联想到了SMC代码保护技术 但是到了后面分析发现分析不下去了,然后找了wp发现是代码反调试技术 然后细细看 ...

  3. Java表达式引擎选型调研分析

    1 简介 我们项目组主要负责面向企业客户的业务系统,企业的需求往往是多样化且复杂的,对接不同企业时会有不同的定制化的业务模型和流程.我们在业务系统中使用表达式引擎,集中配置管理业务规则,并实现实时决策 ...

  4. 文心一言 VS 讯飞星火 VS chatgpt (136)-- 算法导论11.3 2题

    二.用go语言,假设将一个长度为r的字符串散列到m 个槽中,并将其视为一个以 128 为基数的数,要求应用除法散列法.我们可以很容易地把数 m 表示为一个 32 位的机器字,但对长度为r的字符串,由于 ...

  5. go基础-方法

    概述 方法是面向对象编程 (OOP) 的一个特性,在 C++/Java 语言中方法是类函数,go做为函数式编程语言,通过特有技能支持相似的功能,所以说go也支持面向对象编程特性. go 方法本质也是函 ...

  6. 吉特日化MES配料工艺参数标准版-第二版

    作者:情缘 出处:http://www.cnblogs.com/qingyuan/ 关于作者:从事仓库,生产软件方面的开发,在项目管理以及企业经营方面寻求发展之路 版权声明:本文版权归作者和博客园共有 ...

  7. [P7880][Ynoi2006] rldcot

    [Ynoi2006] rldcot 题目描述 给定一棵 \(n\) 个节点的树,树根为 \(1\),每个点有一个编号,每条边有一个边权. 定义 \(dep(x)\) 表示一个点到根简单路径上边权的和, ...

  8. 数字孪生为何开始逐渐与GIS进行融合?

    近年来,数字孪生技术和地理信息系统(GIS)在各自领域的快速发展引起了广泛关注.这两个技术的结合被认为是一种强大的联合,可以为各行各业带来革命性的变革和创新.那么,为何数字孪生开始逐渐与GIS进行融合 ...

  9. vue3+ts打开echarts的正确方式

    实例项目使用 vite5 + vue3 + ts,项目地址 vite-vue3-charts,预览地址 https://weizwz.com/vite-vue3-charts 准备工作 1. 注册为百 ...

  10. 面试官:说说JVM内存整体结构?

    Java JVM内存结构的面试常问知识 说说JVM内存整体的结构?线程私有还是共享的? JVM 整体架构,中间部分就是 Java 虚拟机定义的各种运行时数据区域. Java 虚拟机定义了若干种程序运行 ...