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
This should be something that many people have do...
Table of contents Common array methods pop() unsh...
To beautify the table, you can set different bord...
Table of contents Single-machine deployment Onlin...
MySQL prompts the following error I went to "...
error message: ERROR 2002 (HY000): Can't conn...
Table of contents 1. Why is JavaScript single-thr...
By default, the table title is horizontally cente...
I won't say much nonsense, let's just loo...
Table of contents Implementation ideas: Step 1: C...
Table of contents Preface Global Lock Full databa...
In Linux, the commands cat, more, and less can al...
BEM from QQtabBar First of all, what does BEM mea...
According to data analysis company Net Market Sha...
CSS: 1. <link type="text/css" href=&q...