In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to dynamically expand the root directory of OpenStack CVM online. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
I. background
Generally speaking, the root directory of a CVM is determined when the image is created, and the selected instance type will also limit the size of the CVM / directory when starting the CVM. Occasionally there may be insufficient systems / directories, and there are generally two ways to solve this problem: the first is to add disks and move related files to the new disk; the second is to extend / directories.
2. Two ways to start a CVM
There are also two ways to start a CVM.
2.1. Mode 1: boot from the volume
For a CVM started in this way, the specified volume size must be no less than the root directory size of the image. For example, the image / directory size is 50g, and here it is 100g, but the CVM / directory is still 50g after startup. In this way, the remaining 50g can be directly extended to the / directory. There is a limit to this. The size of the extension is limited, depending on the size specified when the CVM is created. Refer to the second way, you can cross this limit.
Check the partition situation
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTvda 252:0 0 100G 0 disk ├─ vda1 252:1 0 1G 0 part / boot └─ vda2 252:2 0 49G 0 part └─ centos-root 253:0 0 49G 0 lvm /
Zoning the remaining space
# fdisk / dev/vdaCommand (m for help): nPartition type: P primary (2 primary, 0 extended, 2 free) e extendedSelect (default p): pPartition number (3 default 4, default 3): First sector (104857600-209715199, default 104857600): Using default value 104857600Last sector, + sectors or + size {K Magne M J G} (104857600-209715199 Default 209715199): Using default value 209715199Partition 3 of type Linux and of size 50 GiB is setCommand (m for help): wThe partition table has been altered calling ioctl () to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe (8) or kpartx (8) Syncing disks.# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTvda 252 └─ 0 0 100G 0 disk ├─ vda1 252 1 0 1G 0 part / boot └─ vda2 252 part centos-root 253 0 049G 0 lvm / # partprobe# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTvda 252:0 0 100G 0 disk ├─ vda1 252:1 0 1G 0 part / boot ├─ vda2 252:2 0 49G 0 part │ └─ centos-root 253:0 0 49G 0 lvm / └─ vda3 252:3 0 50G 0 part
Create PV
# pvcreate / dev/vda3 Physical volume "/ dev/vda3" successfully created.
Add physical Volum
# vgscan Reading volume groups from cache. Found volume group "centos" using metadata type lvm2# vgextend centos / dev/vda3 Volume group "centos" successfully extended
Extend physical Volum
# df-hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 49G 1.6G 48G 4% / devtmpfs 1.9G 0 1.9G 0 / devtmpfs 1.9G 0 1.9G 0 0 / dev/shmtmpfs 1.9G 8.5m 1.9G 1% / runtmpfs 1.9G 0 1.9G 0% / sys/fs/cgroup/dev/vda1 1014M 145M 870M 15% / boottmpfs 379M 0379M 0% / run/user/0# lvextend-l + 100%FREE / dev/mapper/centos-root Size of logical volume centos/root changed from
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.