LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 03-13-2005, 08:01 PM   #1
majeztik
Member
 
Registered: Apr 2003
Location: Sydney
Distribution: Gentoo
Posts: 56

Rep: Reputation: 15
reducing ext3 lvm's.


Hey guys,

I am trying to resize an LVM from 5000mb to 1000mb. It is currently using an ext3 filesystem. I need to be able to do this without losing any data that is on the partition.

Now after doing a bit of research I came across the example:

umount /home
e2fsadm −L−1G /dev/myvg/
mount /home

Now i know this will certainly work with an ext2 filesystem, but what about ext3?

any comments are appreciated.

cheers.
 
Old 03-14-2005, 12:33 AM   #2
majeztik
Member
 
Registered: Apr 2003
Location: Sydney
Distribution: Gentoo
Posts: 56

Original Poster
Rep: Reputation: 15
hey guys,

I found a solution to this:

Quote:
Logical volumes may be resized dynamically while preserving the data on the volume, if the volume's filesystem supports resizing.

The e2fsadm command allows resizing of an ext2 or ext3 based logical volume. It is a front-end to utilities like lvextend, lvreduce, and resize2fs. ext2online can be used to grow mounted ext2/3 filesystems. Lvextend must be called first to grow the logical volume.

The following commands will grow the mounted /dev/vg0/data filesystem.

lvextend -L +500M /dev/vg0/data

ext2online /dev/vg0/data

e2fsadm -L -16M /dev/vg0/scratch (reduce /dev/vg0/scratch by 16 MB)

e2fsadm -L +128M /dev/vg0/data (extend /dev/vg0/data by 128 MB)

e2fsadm -l -8 /dev/vg0/data (reduce /dev/vg0/data by 8 extents)

For other filesystems, the lvextend utility can be used to add unallocated extents in the volume group to a logical volume. Then native utilities for the filesystem can be used to expand it to fill the volume. To reduce a filesystem, first the native utilities should be used to shrink the filesystem, then lvreduce should be used to shrink the logical volume.
 
Old 04-10-2006, 05:51 PM   #3
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
lvm2 on rhel 4 does not have e2fsadm(it's obsolete).

[root@d400-image ~]# lvresize --resizefs -L 1M /dev/lvm-hdx/lvm0
/dev/cdrom: open failed: Read-only file system
Rounding up size to full physical extent 4.00 MB
fsadm: execlp failed: No such file or directory
fsadm failed: 2

Is there any solution in rhel 4 with NO e2fsadm but still want to shirnk the lv???
 
Old 04-12-2006, 02:33 PM   #4
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
resize2fs, then lvreduce.
 
Old 04-15-2006, 02:24 PM   #5
voip_tech_2004
LQ Newbie
 
Registered: Aug 2004
Posts: 18

Rep: Reputation: 0
resize2fs does not exist on rhel 4
 
Old 04-16-2006, 11:11 PM   #6
shankarjha
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
resize2fs /dev/lvm-hdx/lvm0 +100M
umount /dev/lvm-hdx/lvm0
lvreduce -L +100M /dev/lvm-hdx/lvm0
mount /dev/lvm-hdx/lvm0
ex2online /dev/lvm-hdx/lvm0
Shankar
RHCE
 
Old 01-04-2010, 08:18 AM   #7
rizhun
Member
 
Registered: Jun 2005
Location: England
Distribution: Ubuntu, SLES, AIX
Posts: 268

Rep: Reputation: 47
Did anyone test this?

I needed to decrease a LV from 2GB to 1GB.

I followed a similar method online, but now I have an error when I try and fsck, here's what I did:

Code:
$ umount /my/mount/point
$ fsck -n /lv/device/path                       # returned clean
$ tune2fs -O ^has_journal /lv/device/path       # convert to ext2
$ e2fsck -f /lv/device/path                     # still clean
$ resize2fs /lv/device/path 1G                  # 1GB is orig size
$ e2fsck -f /lv/device/path                     # still clean
$ lvreduce -L -1G /lv/device/path
$ vgreduce myvg /dev/sdd
$ tune2fs -j /lv/device/path
$ fsck -n /lv/device/path
fsck 1.38 (30-Jun-2005)
e2fsck 1.38 (30-Jun-2005)
The filesystem size (according to the superblock) is 1048576 blocks
The physical size of the device is 1044480 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? no

/lv/device/path contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/lv/device/path: 449/262144 files (18.3% non-contiguous), 138541/1048576 blocks
If it's toast, I can restore, but it will annoy me if I don't know how I broke it!

Thanks,
 
Old 01-04-2010, 08:52 AM   #8
rizhun
Member
 
Registered: Jun 2005
Location: England
Distribution: Ubuntu, SLES, AIX
Posts: 268

Rep: Reputation: 47
Fixed it:

Code:
$ e2fsck -f /lv/device/path
$ resize2fs /lv/device/path
I guess this set it back to the original size, which was the entire disk (not including the newly removed disk).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reducing RAM usage Furlinastis Slackware 21 04-02-2005 12:53 PM
Reducing kernel size Kholnuu Slackware 6 01-22-2005 02:57 AM
reducing the kernel kola Debian 4 11-30-2004 03:26 AM
Reducing Load During Backups retep Linux - General 4 01-29-2004 01:54 AM
reducing the size of linux partitions cybergir Linux - Newbie 1 02-04-2003 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration