- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- reduce the size of lvm2
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2007 02:48 AM
03-12-2007 02:48 AM
i am using Redhat EL-4 and configured LVM2
now i want to reduce the logical volume size from 2gb to 1 gb which was mounted on /mnt/lvm and file system is ext3
what are the procedures to reduce the size
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2007 03:28 AM
03-12-2007 03:28 AM
SolutionYou must reduce in two parts:
- Reduce the ext3 file system
- Reduce the logical volume
You must ensure that when you reduce the logical volume, the logical volume size is not less that the file system size or you can loss the data, so you can reduce the file system size and then reduce the logical volume to a size a little bigger than the file system size, to ensure that you won't break the file system.
Procedure to reduce a 6 GB file system/logical volume to 5 GB, in this case, is /dev/rhel4vg/lvrhel4:
*** Check the current size:
# df -h /mnt/rhel4
S.ficheros Tamaà ±o Usado Disp Uso% Montado en
/dev/mapper/rhel4vg-lvrhel4
6,0G 141M 5,8G 3% /mnt/rhel4
# lvdisplay /dev/rhel4vg/lvrhel4
--- Logical volume ---
LV Name /dev/rhel4vg/lvrhel4
VG Name rhel4vg
LV UUID HcD4Es-Ar4s-0GaI-e3GS-29bI-8uuV-EE9NJH
LV Write Access read/write
LV Status available
# open 1
LV Size 6,00 GB
Current LE 1536
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:2
*** Umount the file system an run fsck:
# umount /mnt/rhel4/
# e2fsck -f /dev/mapper/rhel4vg-lvrhel4
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/rhel4vg-lvrhel4: ***** FILE SYSTEM WAS MODIFIED *****
/dev/mapper/rhel4vg-lvrhel4: 11/786432 files (18.2% non-contiguous), 60567/1572864 blocks
*** Resize the file sytem to 5 GB
# resize2fs /dev/rhel4vg/lvrhel4 5G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/rhel4vg/lvrhel4 to 1310720 (4k) blocks.
The filesystem on /dev/rhel4vg/lvrhel4 is now 1310720 blocks long.
*** Resize the logical volume to a value a little bigger than 5 GB (Here you can see in the warning that will be reduced to 5,18 GB)
# lvreduce /dev/rhel4vg/lvrhel4 -L 5300M
/dev/cdrom: open failed: Sistema de ficheros de sà ³lo lectura
Attempt to close device '/dev/cdrom' which is not open.
WARNING: Reducing active logical volume to 5,18 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvrhel4? [y/n]: y
Reducing logical volume lvrhel4 to 5,18 GB
Logical volume lvrhel4 successfully resized
*** Verify the new sizes
# lvdisplay /dev/rhel4vg/lvrhel4
--- Logical volume ---
LV Name /dev/rhel4vg/lvrhel4
VG Name rhel4vg
LV UUID HcD4Es-Ar4s-0GaI-e3GS-29bI-8uuV-EE9NJH
LV Write Access read/write
LV Status available
# open 0
LV Size 5,18 GB
Current LE 1325
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:2
# mount /mnt/rhel4/
# df -h /mnt/rhel4/
S.ficheros Tamaà ±o Usado Disp Uso% Montado en
/dev/mapper/rhel4vg-lvrhel4
5,0G 141M 4,8G 3% /mnt/rhel4
Pretty cool!!, isn't it??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2007 07:03 AM
03-12-2007 07:03 AM
Re: reduce the size of lvm2
rsize2fs is the primary tool for reducing a filesystem. It must be umounted before you reduce it. The logical volume reduce command you have been provided is excellent and yes, quite cool.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2007 03:09 PM
03-12-2007 03:09 PM
Re: reduce the size of lvm2
the way of explain the concept very clear
now the problem has solved
once again thanking u
have a nice day
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2007 03:16 PM
03-12-2007 03:16 PM
Re: reduce the size of lvm2
resize2fs
reduce the volume size
lvreduce