In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to manage LVM volumes on CentOS7 with the help of system storage manager". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Prepare ssm
On the new CentOS/RHEL 7, you need to install the system storage manager first.
$sudo yum install system-storage-manager
First, check the information about available hard drives and LVM volumes. The following command displays information about existing disk storage devices, storage pools, LVM volumes, and storage snapshots. The output is from the newly installed CentOS 7, which uses the LVM and XFS file systems by default.
$sudo ssm list
In this example, there are two physical devices ("/ dev/sda" and "/ dev/sdb"), one storage pool ("centos"), and two LVM volumes created in the storage pool ("dev/centos/root" and "/ dev/centos/swap").
Add physical disks to the LVM pool
You might as well add a new physical disk (such as / dev/sdb) to the existing storage pool (such as centos). The command to add a new physical disk to an existing storage pool is as follows:
$sudo ssm add-p
"when a new device is added to the storage pool, the storage pool automatically expands, depending on the size of the device." Check the size of the storage pool named centos, as shown below.
As you can see, the centos storage pool has been successfully expanded from 7.5GB to 8.5GB. Currently, however, disk volumes located in the storage pool (such as / dev/centos/root and / dev/centos/swap) do not use larger space. To do this, we need to expand the existing LVM volume.
Expand LVM Volum
If you have extra space in the storage pool, you can expand the existing disk volumes in the storage pool. To do this, use the resize option of the ssm command.
$sudo ssm resize-s [size] [volume]
You might as well increase the size of the / dev/centos/root volume by 500MB.
$sudo ssm resize-slots 500m / dev/centos/root
Verify the increased size of the existing volume.
$sudo ssm list volumes
We can verify that the size of the / dev/centos/root volume has increased from 6.7GB to 7.2GB. However, this does not mean that you can immediately use the extra space in the file system created in the volume. You will find that the file system size ("FS size") is still 6.7GB.
In order for the file system to recognize the increased volume size, you need to "expand" the existing file system itself. There are different tools available to expand existing file systems, depending on which file system you use. For example, there are resize2fs for EXT2/EXT3/EXT4, xfs_growfs for XFS, and btrfs for Btrfs, to name a few.
In this example, we use the CentOS 7 dint XFS file system to create it by default. Therefore, we use xfs_growfs to extend the existing XFS file system.
"after expanding the XFS file system, verify that the file system fully consumes the 7.2GB of the entire disk volume."
Create a new LVM pool / volume
In this example, take a look at how to create a new storage pool and a new LVM volume on a physical disk drive. If you use traditional LVM tools, the whole process is quite complex, you need to prepare partitions, you need to create physical volumes, volume groups, logical volumes, and finally a file system. However, if you use ssm, the whole process can be achieved overnight!
The following command creates a storage pool named mypool, creates a 500MB-sized LVM volume named disk0 in the storage pool, formats the volume using the XFS file system, and mounts it under / mnt/test. You can immediately appreciate the power of ssm.
$sudo ssm create-s 500m-n disk0-- fstype xfs-p mypool / dev/sdc / mnt/test
You may wish to verify the disk volumes that have been created.
Take a snapshot of a LVM volume
Using the ssm tool, you can also take snapshots of existing disk volumes. Note that snapshots are applicable only if the backend with volumes supports the snapshot mechanism. The LVM backend supports online snapshots, which means there is no need to take snapshots of volumes offline. In addition, because the LVM backend of ssm supports LVM2, snapshots have read / write capabilities.
Take a snapshot of an existing LVM volume (such as / dev/mypool/disk0).
$sudo ssm snapshot / dev/mypool/disk0
Once the snapshot is taken, it will be stored as a special snapshot volume, storing all the data in the original volume when the snapshot was taken.
After storing the snapshot, you can delete the original volume and mount the snapshot volume to access the data in the snapshot.
Please note: when you try to mount a snapshot volume while the original volume is mounted, you will get the following error message.
Kernel: XFS (dm-3): Filesystem has duplicate UUID 27564026-faf7-46b2-9c2c-0eee80045b5b-can't mount
Delete LVM Volum
Deleting an existing disk volume or storage pool is as easy as creating a disk volume or storage pool. If you try to delete a mounted volume, ssm will automatically unmount it first. There is no trouble in this respect.
To delete a LVM volume:
$sudo ssm remove
To delete a storage pool:
$sudo ssm remove
This is the end of the content of "how to manage LVM volumes with system Storage Manager on CentOS7". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.