LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Extend a partition (https://www.linuxquestions.org/questions/linux-newbie-8/extend-a-partition-870950/)

musiqdefunk 03-25-2011 09:22 AM

Extend a partition
 
Hello

I am a jr linux administrator, that manages a linux enviroment that was built before I got here so most of the management procedures are already established, I just follow them. The problem is now, I was given the task to establish a working linux enviroment for our developers.

So I'm running red hat linux kernel 2.6.18 and LVM2. They have asked me to extend the home directory from 2GB to 10GB.

I used the following command
LVEXTEND -L8G /dev/rootvg/home, with success

My LVdisplay now shows 10G for /dev/rootvg/home but when I do a df -h it still shows /home as 2G.

Is something else I should of done, thanks.

acid_kewpie 03-25-2011 09:38 AM

yes, lvm is not a file system, you have a filesystem inside it, presumably ext3. unmount the filesystem and run "resize2fs /dev/rootvg/home" and it should expand the filesystem to fill the LV. See the resize2fs manpage for further details.

musiqdefunk 03-25-2011 10:45 AM

I umount /home which is an ext3 and ran the resize2fs;I get the following error:

device or resource is busy while trying to open /dev/rootvg/home couldn't find valid filesystem superblock.

jmc1987 03-25-2011 11:07 AM

I think you have to unmount the whole lvm

maybe this might help out
http://www.practicalweb.co.uk/blog/1...filesystem-lvm

sicinthemind 03-25-2011 11:13 AM

Quote:

Originally Posted by musiqdefunk (Post 4303090)
I umount /home which is an ext3 and ran the resize2fs;I get the following error:

device or resource is busy while trying to open /dev/rootvg/home couldn't find valid filesystem superblock.

Revising...

Have you already run the partprobe command?
Code:

AS ROOT
[root@server ~]# partprobe
AS SUDO USER
[user@server ~]$ sudo /sbin/partprobe


musiqdefunk 03-25-2011 12:23 PM

I ran the partprobe, but I don't see what that really did for me, and unmount the whole lvm. I think would defeat the purpose of lvextend.

tommylovell 03-25-2011 12:48 PM

You can resize2fs a mounted file system as long as it is increasing in size. (If you are shrinking it it has to be unmounted.)

Do a 'mount -a' to remount it,

then 'resize2fs /dev/mapper/rootvg-home' again.

It should work.

Here I do a 'resize2fs' against a mounted file system. Nothing to do as it was already the size of the Logical Volume, but just as an example.
Code:

[root@athlonz ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vgz00-lvz01
                      23G  20G  1.8G  92% /
/dev/mapper/vgz01-lvz00
                      493G  163G  306G  35% /bkup
/dev/sda1              99M  14M  80M  15% /boot
/dev/sdb1              99M  43M  51M  46% /boot2
tmpfs                2.0G  80K  2.0G  1% /dev/shm
/dev/mapper/vgz01-tommy
                      20G  11G  7.9G  59% /home/tommy
[root@athlonz ~]# resize2fs /dev/mapper/vgz01-tommy
resize2fs 1.41.4 (27-Jan-2009)
The filesystem is already 5242880 blocks long.  Nothing to do!

[root@athlonz ~]# resize2fs /dev/vgz01/tommy
resize2fs 1.41.4 (27-Jan-2009)
The filesystem is already 5242880 blocks long.  Nothing to do!

[root@athlonz ~]#

ps. when you did the umount, did it succeed. If anyone is in that directory or has a file open there umount will fail.

musiqdefunk 03-25-2011 02:12 PM

Keeping it mounted worked, thanks guys, you made me look like a genius.


All times are GMT -5. The time now is 02:58 PM.