Preface This article describes how to shrink the System environmentCentOS 8 Current system partition layout This is the current file system layout. The current mount point Backing up your dataBe sure to back up important data before shrinking the partition. If something goes wrong, you can restore the data. Note: You need to add an extra hard disk to the server to back up the system partition. Enter rescue modeIn VMware Workstation, load the CD and start the machine. Press F2 when booting, enter BIOS, and switch to the Boot tab. Move the CD-ROM Drive to the Hard Drive. Press F10 to save and reboot. Select Troubleshooting, then choose Enter Rescue Mode. When you enter the following interface, select 3 to enter the shell interface directly. After entering the rescue mode, you can see that the # ls -al /mnt/sysimage/ Activate Logical Volume GroupBefore mounting the partition, you need to activate the logical volume. To activate the volume group: # vgchange -ay 2 logical volume(s) in volume group "cl" now active # vgs VG #PV #LV #SN Attr VSize VFree cl 1 2 0 wz--n- <19.00g 0 Mount the system partition and the partition used to backup data First starting with the backup, we need to mount the logical volume somewhere. By temporarily mounting it we can back up Now, create two directories under /mnt/sysimage/. One to mount the actual # mkdir /mnt/sysimage/root # mkdir /mnt/sysimage/backup # mount /dev/cl/root /mnt/sysimage/root # mount /dev/sda /mnt/sysimage/backup/ Backing up the / partition using xfsdump Perform the backup by running # xfsdump -l 0 -L "root lv backup" -M "backup" -f /mnt/sysimage/backup/root_backup.img /mnt/sysimage/root When dump uses level Unmounting the file systemOnce the backup is complete, we can unmount the file system. # umount /mnt/sysimage/root/ Reduction/Partitioning Use the # lvremove /dev/cl/root Do you really want to remove active logical volume cl/root? [y/n]: y Logical volume "root" successfully removed After that, create the required logical volume size. Below we create a logical volume of size 15G. # lvcreate -Zy -L 15G -n root cl Use Create a New XFS Partition# mkfs.xfs /dev/cl/root Mount and restore dataOnce the file system is ready, mount it in the /mnt/sysimage/root directory: # mount /dev/cl/root /mnt/sysimage/root/ Use the # xfsrestore -f /mnt/sysimage/backup/root_backup.img /mnt/sysimage/root Restart the system and check whether it is normal. Disconnect the CD-ROM drive of the virtual machine, press F2 to start the computer, enter BIOS, set the boot order, put the hard disk in the first boot, press F10 to save and restart: After entering the system, check whether the partition size has been reduced: [root@localhost ~]# df -hT / Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/cl-root xfs 15G 1.7G 14G 11% / Summarize That’s it, with the help of This is the end of this article about reducing the root directory of the XFS partition format in Linux. For more relevant content about reducing the root directory of the XFS partition format in Linux, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Let IE support CSS3 Media Query to achieve responsive web design
>>: Detailed explanation of angular content projection
Form provides two ways of data transmission - get ...
Database version: mysql> select version(); +--...
Today I will share with you a source code contain...
Preface MySQL continued to maintain its strong gr...
Table of contents Installation Environment Descri...
1. Download the mysql repo source $ wget http://r...
Phenomenon When using Apache Spark 2.x, you may e...
Table of contents Memory Pool Overview 1. nginx d...
Preface The concept of dark mode originated from ...
When compiling and installing Nginx, some modules...
There are many MySQL variables, some of which are...
Table of contents 1. Environmental Preparation 1....
Table of contents 1. Choose the most appropriate ...
There are two types of MySQL installation files, ...
This article shares the specific code of JS to ac...