How to increase the disk space of /home
Hi,
I have a RHEL4 server in which i had configured LVM. I had added secondary HDD sdb and created 2 partitions sdb1 and sdb2 of which sdb1 was created as LVM and added it to existing VG (/home dir) when there was space crunch and i mounted sdb2 as another mount point. Is there any way to increase the size of the VG created earlier using the sdb2 partition?? My problem here is i'm running out of space in my /home dir which is created as VG.I'm not sure whether i can use sdb2 partition and increase the VG size?? |
You can do that.
Quote:
More verbose: It is possible with at least the following steps: * backup/move/delete data in file system on sdb2 * change sdb2 to partition type lvm * add sdb2 as PV to VG, that is used for LV containing home's data (old data lost now) * unmount LV mounted as /home * check file system before changing it (fsck) * grow file system of the LV * mount your bigger LV to /home again Why does it work - or - The story behind: A volume group (VG) is formed from at least one physical volume (PV). A PV is a hard disk partition created with type lvm. Finally inside a VG you create the logical volume (LV). LVs are like hard disk partitions, but with LVM the whole VG is seen like a single hard disk and partition size can be changed during - almost - normal OS operation. However, you need a file system to format, mount and use space of a LV in your system. You can add more PVs to a VG at any time and expand existing LVs to use them, thats why you have LVM, not a "solid" partition schema. If you have enough free space to move all used stripes away from a PV to other PVs in the same VG, you could even remove it as well. To use an expanded LV, you have to resize (grow) the file system (ext2/ext3/reiserfs/xfs/..). But be careful, before you shrink a PV you'll have to shrink the file system inside it, or you'll corrupt it. Not every file system supports both, growing and shrinking. You should know and choose accordingly before the first use, not when your volume is filled. BTW, freeing blocks exclusively reserved for the superuser might give you time to learn more about LVM before you change anything. Some more sentences of caution: You may corrupt your file system in the process and need a fresh backup. Sure, you have a backup, haven't you? If this is a production system, our LVM is built on top of RAID devices. Use what suites your needs and what you can afford. Newer rely on LVM entirely. However, it's great. I've not lost data while changing partitions inside a LVM system within the last 4 years, using both, LVM and LVM2, the current. |
Quote:
|
He didn't say that, he said you lose the data on the sdb2.
|
clarification
Quote:
The way I recommended to you will not destroy anything in /home. But there is no guaranty working with data like a professional would do will require to always have a way back. Your and/or others home directory should be definitely on (top of) a list of important data, since you have to expect personal, unique data there, that you could hardly restore from common sources like you'd do in case of an OS restore i.e. from distribution packages. So having a full (working!) backup is right, even if you don't expect data loss at all. |
Hi All,
I've increased the disk space of my /home by creating a PV using the sdb2 partition and increasing the size of the VG and LV(/home). Thanks for your support guys... |
All times are GMT -5. The time now is 01:19 AM. |