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
Chinese Tutorial https://www.ncnynl.com/category/...
Tomcat is widely known as a web container. It has...
Introduction <br />Not everyone has access t...
Table of contents Function Introduction function ...
Vue bus mechanism (bus) In addition to using vuex...
This article example shares the specific code of ...
Flappy Bird is a very simple little game that eve...
Preface Review and summary of mobile terminal rem...
Declaring variables Setting Global Variables set ...
<br /> This article is translated from allwe...
Let’s not waste any more time and get straight to...
Preface: Lynis is a security audit and hardening ...
Copy code The code is as follows: <!DOCTYPE ht...
Table of contents Effect display Code Link Key Co...
The key is that the local server does not have wr...