HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Reducing ext3 LVM2 filesystem on RHEL 4 AS.
Operating System - Linux
1829404
Members
1771
Online
109991
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
09-12-2007 07:04 AM
09-12-2007 07:04 AM
I would like to reduce /u02 filesystem about 5GB (from 35GB to 30GB), this mount point is not in use now.
I would really appreciate if someone could provide me appropriate commands/steps.
[root@dev06 ~]# df -h /u02
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup01-LogVol12
35G 15G 19G 45% /u02
Thanks,
Gulam.
I would really appreciate if someone could provide me appropriate commands/steps.
[root@dev06 ~]# df -h /u02
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup01-LogVol12
35G 15G 19G 45% /u02
Thanks,
Gulam.
Everyday Learning.
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2007 07:47 AM
09-12-2007 07:47 AM
Solution
Before reducing the size of a file system, take a full backup of it!!!!
You 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? yes
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??
You 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??
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP