Created
July 19, 2012 16:39
-
-
Save knzm/3145179 to your computer and use it in GitHub Desktop.
memo: remove a disk from LVM with shrinking ext3 partition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. check free space by running "df -h" | |
| => under 50%, ok | |
| 2. unmount the volume | |
| 3. dumpe2fs -h /dev/VolGroup00/data | |
| Block count: 10483712 | |
| Reserved block count: 524069 | |
| Free blocks: 6391697 | |
| Free inodes: 2621196 | |
| First block: 0 | |
| Block size: 4096 | |
| 4. e2fsck -fC0 /dev/VolGroup00/data | |
| => /dev/VolGroup00/data: 244/2621440 files (17.6% non-contiguous), 4092015/10483712 blocks | |
| 5. resize2fs -p /dev/VolGroup00/data 5000000 | |
| 6. mount, check size, then unmount | |
| 7. lvdisplay | |
| LV Size 39.99 GiB | |
| Current LE 10238 | |
| 8. lvreduce -l 5119 /dev/VolGroup00/data | |
| 9. vgdisplay | |
| Alloc PE / Size 5119 / 20.00 GiB | |
| Free PE / Size 5119 / 20.00 GiB | |
| 10. e2fsck -fC0 /dev/VolGroup00/data | |
| 11. resize2fs -p /dev/VolGroup00/data | |
| 12. vgreduce VolGroup00 /dev/xvdg1 | |
| 13. pvscan | |
| PV /dev/xvdf1 VG VolGroup00 lvm2 [20.00 GiB / 0 free] | |
| PV /dev/xvdg1 lvm2 [20.00 GiB] | |
| Now we can detach the volume xvdg! (unless any other partitions are used) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment