阿里云CentOS数据盘挂载(磁盘扩容)

简介: 阿里云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

 

目录
相关文章
|
1月前
|
安全 Linux 定位技术
如何在CentOS中卸载LVM磁盘
综上,卸载LVM的过程就像是一场探险,需要小心翼翼地按照地图行动,不能偏离原定的路线。希望我手绘的这张地图对你有所帮助,让你能平安顺利地完成解除LVM的挑战。记住,整个过程中你都得小心谨慎,否则就可能会丢掉紧张刺激、惊险无比的宝石。在这个探险中,我为你解答了如何卸载LVM,提供了明确的指导和路线。人生就是一场探险,希望你在这个过程中学到的不仅仅是如何卸载LVM,更多的是如何在解决问题的过程中,认识自我,挑战自我,超越自我。那么,探险家们,还在等什么,让我们开始吧!
110 35
|
1月前
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
505 29
|
3月前
|
存储 安全 Linux
Centos 8系统ext4文件系统类型进行扩容缩容 (LVM)
通过使用这些技术和工具,可以有效管理CentOS 8系统上的存储资源,确保系统在高负载和高并发情况下的稳定运行。
227 9
|
3月前
|
Linux
CentOS U盘挂载指南
在 CentOS 中挂载 U 盘的步骤如下:1. 使用 `sudo fdisk -l` 或 `lsblk` 检测 U 盘设备(如 `/dev/sdb1`)。2. 创建挂载点 `sudo mkdir /mnt/usb`。3. 根据格式挂载 U 盘,如 FAT32 使用 `sudo mount -t vfat /dev/sdb1 /mnt/usb -o rw,uid=1000,gid=1000`。4. 访问数据 `cd /mnt/usb && ls -l`。5. 卸载 `sudo umount /mnt/usb`。常见问题包括权限和中文乱码,可添加相应参数解决。
220 2
|
4月前
|
存储 Linux
Centos 8 磁盘扩展xfs文件系统 (LVM)
│ ├── 注意事项 │ ├── 备份数据 │ ├── 检查磁盘状态 │ └── 确认设备名称 │ └── 总结 ```
182 14
|
4月前
|
监控 Linux
centos 中查看 内存及磁盘使用率
通过这些命令,您可以全面了解系统资源的使用情况,从而更好地管理和优化系统。
712 22
|
6月前
|
Ubuntu Linux 虚拟化
CentOS7扩容踩坑记录(最后只有ubuntu成功)
这篇博客记录了一次尝试给CentOS根分区扩容的过程。作者在VMware中扩展了虚拟磁盘,但最终未能成功将新分区合并到现有卷组中,因为原有分区未创建物理卷(PV)和卷组(VG)。过程中遇到了多个问题,如分区文件正在使用中等。最终作者提醒读者在操作前务必先检查当前的分区和卷组状态。
126 4
CentOS7扩容踩坑记录(最后只有ubuntu成功)
|
5月前
|
弹性计算 运维 安全
阿里云操作系统迁移最佳实践|飞天技术沙龙-CentOS 迁移替换专场
本次方案的主题是阿里云操作系统迁移最佳实践,Alibaba Cloud Linux /Anolis OS 兼容 CentOS 生态,因此能够很丝滑的进行迁移替换。无论是对企业的运维人员,还是对企业操作系统的使用者来说,相对简化了它的维护成本。通过 SMC 操作系统迁移实践带用户深入了解,不仅阐述了原地迁移方案的独特优势,还针对不同的迁移场景,逐步剖析了整个迁移流程,力求使复杂的操作变得直观易懂,实现了真正的“白屏化”体验。 1. CentOS 迁移背景 2. 操作系统迁移实践 3. 迁移故障处理
152 2
|
5月前
|
监控 安全 Linux
龙蜥社区及阿里云CentOS迁移方案|飞天技术沙龙-CentOS 迁移替换专场
本次分享的主题是龙蜥社区及阿里云 CentOS 迁移方案|飞天技术沙龙- CentOS 迁移替换专场,由阿里云产品专家周絮分享。主要分为三个部分: 1.背景介绍 2.方案选型 3.迁移支持
134 0
|
7月前
|
存储 监控 Linux
在 CentOS 7 中如何对未分配的大容量硬盘进行分区和挂载。通过具体案例,详细说明了使用 `fdisk` 创建分区、格式化分区、创建挂载点以及临时和永久挂载分区的步骤
本文介绍了在 CentOS 7 中如何对未分配的大容量硬盘进行分区和挂载。通过具体案例,详细说明了使用 `fdisk` 创建分区、格式化分区、创建挂载点以及临时和永久挂载分区的步骤。此外,还分享了一些实践经验,帮助读者更好地管理和优化磁盘空间。
603 8