赞
踩
1. 查看设备挂载的情况
- [root@192 ~]# lsblk
- NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
- vda 253:0 0 40G 0 disk
- └─vda1 253:1 0 40G 0 part /
- vdb 253:16 0 100G 0 disk
2.分区
[root@192 ~]# fdisk /dev/vd vda vda1 vdb [root@192 ~]# 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 0x538b9e95. 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): 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!
3. 格式化硬盘
mkfs.ext4 /dev/vdb1
4. 创建挂载点,例如
mkdir /database
5. 挂载硬盘
mount /dev/vdb1 /database
6. 查看结果
df -h
7. 设置系统自动挂载硬盘
- vi /etc/fstab
- /dev/vdb1 /database ext4 defaults 0 0
https://help.aliyun.com/document_detail/111738.html?spm=a2c4g.11186623.6.801.4faf7f67tzAtVh阿里链接
1,买好磁盘后可以看到vda 还有100G 的空间
- [root@192 ~]# lsblk
- NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
- vda 253:0 0 150G 0 disk
- └─vda1 253:1 0 40G 0 part /
- vdb 253:16 0 100G 0 disk
- └─vdb1 253:17 0 100G 0 part /database
- [root@192 ~]# growpart /dev/vda 1
- CHANGED: partition=1 start=2048 old: size=83873317 end=83875365 new: size=314566717,end=314568765
2,看到磁盘块满了,下面开始扩容
- [root@192 ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/vda1 40G 36G 1.5G 97% /
- devtmpfs 3.9G 0 3.9G 0% /dev
- tmpfs 3.9G 0 3.9G 0% /dev/shm
- tmpfs 3.9G 1000K 3.9G 1% /run
- tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
- /dev/vdb1 99G 360M 93G 1% /database
- overlay 40G 36G 1.5G 97%
3.命令调用growpart为需要扩容的云盘和对应的第几个分区扩容
- [root@192 ~]# growpart /dev/vda 1
- CHANGED: partition=1 start=2048 old: size=83873317 end=83875365 new: size=314566717,end=314568765
4.运行resize2fs <PartitionName>
命令调用resize2fs扩容文件系统。
- [root@192 ~]# resize2fs /dev/vda1
- resize2fs 1.42.9 (28-Dec-2013)
- Filesystem at /dev/vda1 is mounted on /; on-line resizing required
- old_desc_blocks = 3, new_desc_blocks = 10
- The filesystem on /dev/vda1 is now 39320839 blocks long.
5.运行df -h
命令查看云盘分区大小
- [root@192 ~]# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/vda1 148G 37G 105G 27% /
- devtmpfs 3.9G 0 3.9G 0% /dev
- tmpfs 3.9G 0 3.9G 0% /dev/shm
- tmpfs 3.9G 1000K 3.9G 1% /run
- tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
- /dev/vdb1 99G 360M 93G 1% /database
- overlay 148G 37G 105G 27%
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。