1831483 Members
3346 Online
110025 Solutions
New Discussion

Extending Filesystem

 
Cliff Lim Kok Hwee
Regular Advisor

Extending Filesystem

Gd Day Forum,

Recently, I created the following /doc-root filesystem of size 4096MB during Linux installation.

volgroup vg01 pv.02
logvol /doc-root --vgname vg01 --fstype ext3 --size 4096 --name lvol2

df -k

/dev/vg01/lvol2 4128448 218456 3700280 6% /doc-root


I would need to increase the /doc-root by extra 6144MB.

Can anyone advise me on both the lv extension and fileystem extension?

lvextend -L +6144 /dev/vg01/lvol2

Thanks/cliff
5 REPLIES 5
Stuart Browne
Honored Contributor

Re: Extending Filesystem

If you've got a recent distribution and recent filesystem tools and LVM tools (i.e. LVM 1.3 or newer), then doing the 'vextend' should automatically increase the filesystem.

If not, you should have access to the 'resize2fs' (or 'ext2resize'), or the online tool 'ext2online' to resize.

The 'lvextend' (or 'lvresize') commands allow you to extend the underlying partition (logical volume). The syntax there is good.

Just did it here on my system:

lvresize -L +2G /dev/vgLocal/lvVar
ext2online /dev/vgLocal/lvVar

This was quite happily extended the filesystem.
One long-haired git at your service...
Cliff Lim Kok Hwee
Regular Advisor

Re: Extending Filesystem

Hi Forumers,

I am thinking of doing the following,

-lvextend -L +6144 /dev/vg01/lvol2
-umount /dev/vg01/lvol2
-e2fsck -f /dev/vg01/lvol2
-resize2fs /dev/vg01/lvol2
-mount /dev/vg01/lvol2

Query:

-Even though it is a ext3 fileystem, the command resize2fs still is applicable?

-Do not think there is a need to bring it down to runlevel 1?

- Understand it is better to do it offline for filesystem extension?

Thanks/cliff

Stuart Browne
Honored Contributor

Re: Extending Filesystem

Righteo..

Those commands are fine.

You don't have to bring the system into single user mode, so long as the filesystem you are attempting to extend is not in use. As you're planning on unmounting it, you'll be fine.

Now, as for whether it's better to do it offline or online, well you're already planning to do it offline.

You can quite happily increase a filesystem online, and I have done so in the past a number of times. Reducing filesystems used to have to be done offline, and from my brief testing earlier, it apperas to still be the case.

Now, as in all things like this, make sure you have a nice backup of your data handy, even though these are well tested and reasonably stable things to be done (I did it on my live system's '/var' filesystem, so that's a pretty decent test! :), but it's beter to be safe than sorry.
One long-haired git at your service...
Cliff Lim Kok Hwee
Regular Advisor

Re: Extending Filesystem

Hi Bros,

- Even though it is a ext3 fileystem, the command resize2fs still is applicable?

Thanks/cliff
Stuart Browne
Honored Contributor

Re: Extending Filesystem

Sorry, forgot to address that.

Yes.

EXT2 and EXT3 have only one difference, and that's the journaling done on the OS level. The underlying filesystem structure is identical.

The 'e2fsprogs' work on all ext2 and ext3 based filesystems.
One long-haired git at your service...