Shrink existing /home LVM with xfs format

Summary ProblemNo free sectors available install xfsdump dump the home system to temhomedump umount home delete create and format with shrank size mount restore home successful result reduced to 10G from 108G problem still exist cannot create new partition below action will crash the root system Refernce Summary If you require to shrink the file system with xfs format, unfortunately there is no method to do so, in my case, the /root and /home system was installed in the LVM, and with xfs file system, cannot do much to /root system, dumped out /home file system, format and shrank the file system and restored the /home system.

RHCE6 Preperation (6) – httpd, lvm, grep, ssh, nfs

1, install the http server, make it automatically startup yum install -y http* /etc/init.d/httpdd start chkconfig httpd on 2, create logical volume, name as lv0, lv0 belong to logical group vg0, PE size as 8M, logical volume as 40 PE, formatted as ext4, mount to /data, and make it automatically mounted when start, fdisk /dev/sda to create physical partition, label as 0x8e, make it usable by partx command,   partx -a /dev/sda   create pv, pvcreate /dev/sda4 create vg, the PE size as 8M vgcreate –s 8M vg0 /dev/sda4  create lv, name as lv0, size as 40 PE.

RHCE6 Preperation (3) – find & copy, lvm resize, swap partition create

1, find the file belong to lucy and copy to a folder, create the find folder, mkdir /tmp/findfiles find the file the owner is lucy, use the parameter -user and -exec find / -user lucy -exec cp -a {} /tmp/findfiles \; 2, enlarge the lvm, no need to umount, lvextend -L 190M /dev/mapper/vgsrv-common then extend the file system, resize2fs /dev/mapper/vgsrv-common you can also use the UI to edit the logic volume size, yum install system-config-lvm system-config-lvm In the logic volume size, click the ‘edit properties’, and drag the size bar to modify the size.

LVM test

Did some LVM test, recorded the procedure, I have a disk having space as 160G,  showing as: [root@localhost ~]# fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes, 312581808 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x210edd27 Device Boot      Start         End      Blocks   Id  System /dev/sda1            2048    83891429    41944691   82  Linux swap / Solaris /dev/sda2        83891430   167782859    41945715    7  HPFS/NTFS/exFAT /dev/sda3       167782860   251674289    41945715    7  HPFS/NTFS/exFAT /dev/sda4       251674290   312576704    30451207+   c  W95 FAT32 (LBA) 1, create a VG(volume group), the PE(physical extend) as 16M, name as xiongvg, then add the sda4