阿里云数据盘无损扩容

IT
IT
IT
335
文章
1
评论
2020年5月21日14:00:03 评论 1,355 3351字阅读11分10秒

磁盘扩展

阿里云数据盘无损扩容

扩容了10GB阿里云数据盘无损扩容

 

重启服务器

必须得重启,不然不生效。

重启之后看看里面的数据是否完好无损

[root@izj5ebh78jj2s7z128jseqz ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.5G 36G 4% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 308K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vdb1 20G 45M 19G 1% /home
tmpfs 783M 0 783M 0% /run/user/0
[root@izj5ebh78jj2s7z128jseqz ~]# cd /home/
[root@izj5ebh78jj2s7z128jseqz home]# ll
total 20
-rw-r--r-- 1 root root 5 Jan 28 18:39 1.txt
drwx------ 2 root root 16384 Jan 28 18:38 lost+found
[root@izj5ebh78jj2s7z128jseqz home]# cat 1.txt 
sdsd

扩展

[root@iZj5eczs1dw6sj01j7hbfeZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 2.2G 36G 6% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 336K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vdb1 20G 45M 19G 1% /home
tmpfs 783M 0 783M 0% /run/user/0

查看磁盘容量

[root@iZj5e9lfz8aw5hjsy7r68qZ ~]# df -h 
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.5G 36G 4% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 304K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vdb1 20G 45M 19G 1% /home
tmpfs 783M 0 783M 0% /run/user/0
[root@iZj5e9lfz8aw5hjsy7r68qZ ~]# 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: 0x0008de3e

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83884031 41940992 83 Linux

Disk /dev/vdc: 32.2 GB, 32212254720 bytes, 62914560 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: 0xc117ec4b

Device Boot Start End Blocks Id System
/dev/vdc1 2048 41943039 20970496 83 Linux

得停止使用磁盘得应用

[root@iZj5eczs1dw6sj01j7hbfeZ ~]# umount /dev/vdb1
[root@iZj5eczs1dw6sj01j7hbfeZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 2.2G 36G 6% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 336K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 783M 0 783M 0% /run/user/0

开始扩容

[root@iZj5eelw0yngbi1wc1yca5Z ~]# 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.


Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): n
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-62914559, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62914559, default 62914559): 
Using default value 62914559
Partition 1 of type Linux and of size 30 GiB is set

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZj5eelw0yngbi1wc1yca5Z ~]# e2fsck -f /dev/vdb1
e2fsck 1.42.9 (28-Dec-2013)
/dev/vdb1 is mounted.
e2fsck: Cannot continue, aborting.


[root@iZj5eelw0yngbi1wc1yca5Z ~]# resize2fs /dev/vdb1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vdb1 is mounted on /home; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vdb1 is now 7864064 blocks long.

验证

[root@iZj5eelw0yngbi1wc1yca5Z ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.6G 36G 5% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 308K 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 783M 0 783M 0% /run/user/0
/dev/vdb1 30G 44M 28G 1% /home
[root@iZj5eelw0yngbi1wc1yca5Z ~]# cd /home/
[root@iZj5eelw0yngbi1wc1yca5Z home]# ll
total 20
-rw-r--r-- 1 root root 7 Jan 28 18:17 1.txt
drwx------ 2 root root 16384 Jan 28 18:17 lost+found
[root@iZj5eelw0yngbi1wc1yca5Z home]# cat 1.txt 
sddsds

 

继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
IT
  • 本文由 发表于 2020年5月21日14:00:03
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Eureka同步到nacos Nacos

Eureka同步到nacos

官方介绍文档地址 https://nacos.io/zh-cn/docs/nacos-sync.html 官方安装文档地址 https://nacos.io/zh-cn/docs/nacos-sync...
Eureka指定应用的instanceId为IP CentOS

Eureka指定应用的instanceId为IP

痛点 现在所有的应用指定的是服务器默认机器名称,对查看是哪一个服务IP或者单节点自动剔除服务不友好。 像如上图所示,想知道是哪一个节点,还得点开才能获取IP。 改造 全部改成自动获取服务器IP为ins...
阿里云网盘 CentOS

阿里云网盘

申请内测地址 https://survey.aliyun.com/apps/zhiliao/_o6XQjioM 官网地址 https://www.teambition.com/products/pan...
GitLab或Jenkins集成构建工具 CentOS

GitLab或Jenkins集成构建工具

集成构建工具 构建工具是用来将代码编译打包成制品的工具。例如前端项目我们一般使用npm进行打包,后端java项目我们一般使用maven、gradle进行打包。构建工具很多很多,但是集成到gitlab中...