阿里云CentOS数据盘挂载(磁盘扩容)
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数据盘挂载(磁盘扩容)的更多相关文章
- 阿里云ECS 实例Centos7系统磁盘扩容
需求:一台阿里云的数据盘磁盘空间不足,需要扩容,我这里只有一个主分区,ext4文件系统. 因为磁盘扩容场景不同,阿里云的文档比较全面一些,所以先奉上阿里云的文档,下面开始我的操作步骤: 1.登录控制台 ...
- 阿里云ECSLinux系统下挂载磁盘
最近公司服务器老是提示磁盘空间不足,原因是以前的业务负责人开了Tomcat的debug日志并且没有做日志轮询,所以日志量非常大.当我做了日志切割轮询后发现磁盘还是太小才40G,按理外网服务器怎么可能这 ...
- 阿里云CentOS 7服务器挂载数据盘
本次使用的是centOS 7.4 64位操作系统 第一步:查看磁盘情况 我们发现,我总共有三个磁盘,分别为/dev/vda(100G)./dev/vdb(200G)./dev/vdc(100G),而被 ...
- 阿里云CentOS 7系统挂载SSD云盘的教程_Linux
一.查看SSD云盘 sudo fdisk -l Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors ...
- 阿里云CENTOS服务器挂载数据盘
阿里云Linux云服务器数据盘默认是未做分区和格式化的,使用前需要先挂载数据盘.步骤如下: 1.查看数据盘 在没有分区之前,使用 1 df -h 2.命令,是无法查看到数据盘的,可以使用 1 ...
- 阿里云Linux服务器,挂载硬盘并将系统盘数据迁移到数据盘
因为之前用宝塔上线,宝塔只挂载了系统盘50G,打开阿里云云盘列表发现系统盘无法直接升级,故另买一块数据盘挂载到Linux服务器下,下面根据网上教程再结合我实际情况讲解一下实际操作,其实非常easy l ...
- CentOS系统下的数据盘挂载
此教程适用系统:Linux(CentOS,Debian,Ubuntu,Fedora) 通常新开通的Linux云服务器数据盘都未做分区和格式化.在进行数据盘挂载之前我们要先进行分区以及格式化操作.注意, ...
- 阿里云Linux格式化数据盘,分区并挂载一个文件系统
阿里云一块全新的数据盘挂载到ECS实例后,您必须创建并挂载至少一个文件系统.本示例使用I/O优化实例,操作系统为CentOS 7.6,为一块新的300GiB数据盘(设备名为/dev/vdb)创建一个M ...
- 阿里云-CentOS如何挂载硬盘
阿里云CentOS挂载硬盘 查看当前未挂载的硬盘 # fdisk -l 创建硬盘分区 # fdisk /dev/vdb 根据提示,依次输入"n","p" &qu ...
- linux系统数据盘挂载教程
将数据盘挂载为/www命令:#mkdir /www & mount /dev/sdb1 /www ----------------------------------------------- ...
随机推荐
- 一篇文章带你掌握测试基础语言——Python
一篇文章带你掌握测试基础语言--Python 本篇文章针对将Python作为第二语言的用户观看(已有Java或C基础的用户) 因为之前学习过Java语言,所以本篇文章主要针对Python的特征和一些基 ...
- CSP 2023 游只因
CSP \(2023\) 游只因 前面不写太多. Day \(-\frac{114514}{191}\) 雅礼(HN 四大名校)集训. Day 1:考试,讲题,改题. Day 2:考试,讲题,改题. ...
- 【scipy 基础】--信号处理
scipy.signal模块主要用于处理和分析信号.它提供了大量的函数和方法,用于滤波.卷积.傅里叶变换.噪声生成.周期检测.谱分析等信号处理任务. 此模块的主要作用是提供一套完整的信号处理工具,从而 ...
- Redis缓存使用技巧和设计方案?薪火数据知识库
Redis是一种开源的内存数据库,被广泛应用于缓存系统设计和实现中.它提供了高性能.低延迟的数据访问,并支持多种数据结构和丰富的功能.下面将详细介绍Redis缓存的使用技巧和设计方案. 一.Redis ...
- jdk10的var局部变量类型推理
注:本人参考了openjdk官网,由于openjdk是开源的,所以不存在侵权行为,本章只为学习,我觉得没有什么比官网更具有话语权 1.jdk10的var的类型推测:就是这种处理将仅限于具有初始值设定项 ...
- springCore完整学习教程2,入门级别
上集说到:2. 3,咱们从2.3集开始 2. Externalized Configuration 2.3. External Application Properties Spring Boot会自 ...
- [ABC262B] Triangle (Easier)
Problem Statement You are given a simple undirected graph with $N$ vertices and $M$ edges. The verti ...
- cocos2d-Js 各类碰撞检测
这里总结一下点.圆.矩形之间的简单碰撞检测算法(矩形不包括旋转状态) 点和圆的碰撞检测: 1.计算点和圆心的距离 2.判断点与圆心的距离是否小于圆的半径 isCollision: function(p ...
- 如何为项目配置opencv
如何为项目配置opencv 13/100 发布文章 public669 未选择任何文件 new 配置: 包含目录: D:\OpenCV\opencv\build\include D:\OpenCV\o ...
- 组合式api-侦听器watch的语法
和vue2对比,也是语法上稍有不同. 监听单个数据对象 <script setup> import {ref, watch} from "vue"; const cou ...