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. GitHub Universe 2023:AI 技术引领软件开发创新浪潮

    GitHub 是全球领先的软件开发和协作平台,数百万开发者和企业在此分享.学习和创建卓越的软件.同时 GitHub 处在 AI 技术前沿,通过其先进的 AI 技术增强开发者体验并赋能未来软件开发的使命 ...

  2. 你真的了解@Async吗?

    使用场景: 开发中会碰到一些耗时较长或者不需要立即得到执行结果的逻辑,比如消息推送.商品同步等都可以使用异步方法,这时我们可以用到@Async.但是直接使用 @Async 会有风险,当我们没有指定线程 ...

  3. go基础-方法

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

  4. C语言-变量常量数据类型

    常量:不会变化的数据.不能被修改. 1. "hello".'A'.-10.3.1415926(浮点常量) 2. #define PI 3.1415 [强调]:没有分号结束标记. [ ...

  5. 如何在Web应用中添加一个JavaScript Excel查看器

    前言 在现代的Web应用开发中,Excel文件的处理和展示是一项常见的需求.为了提供更好的用户体验和功能,经常需要在Web应用中添加一个JavaScript Excel查看器,小编今天将为大家展示如何 ...

  6. CH395实现主动ping对端功能(代码及说明)

    目录 1.PING原理 1.1简介 1.2协议 1.3通信流程 2.代码解释 3.工程链接 PING原理 1.简介 PING是基于ICMP(Internet Control Message Proto ...

  7. 2018年长沙理工大学第十三届程序设计竞赛 G 题:逃离迷宫

    题目链接:https://www.nowcoder.com/acm/contest/96/G 思路:两遍bfs,找到p到k的情况,记录时间:找到E到k的情况,记录时间.题目超时点在于输入需要用scan ...

  8. Liunx--centos7服务器上 安装 jenkins,实现持续集成发布

    1.下载并安装jenkins wget -v https://pkg.jenkins.io/redhat-stable/jenkins-2.176.3-1.1.noarch.rpmrpm -ivh j ...

  9. Arrarylist集合的使用

    前提:最近JAVA实训课老师讲了一些Arrarylist集合的相关知识,刚好端午假期有空就把这课上学到的知识和自己碰到的一些问题总结下来. 一.Arrarylist集合的使用(以学生信息存储作为演示) ...

  10. java,ArrayList类

    ArrayList 是一个数组列表,可以将多个对象放入数组中,是一个长度可变的集合,提供了增删改查的功能. public class Test2 { public static void main(S ...