Shrink ext4 filesystem and reduce the size of a Logical Volume in Linux


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Shrink ext4 filesystem and reduce the size of a Logical Volume in Linux
# 1  
Old 02-14-2017
Linux Shrink ext4 filesystem and reduce the size of a Logical Volume in Linux

Hello guys,
I would like to ask you kindly if you don't know some quick and safe method how to shrink ext4 filesystem and reduce the size of a Logical Volume in Linux, please?
Thank you very much.
# 2  
Old 02-14-2017
Welcome los_bandidos,

You need to be able to unmount the filesystem. If that is not possible, then you are a bit stuck, but it is still possible however it will mean downtime.

What OS are you using? Assuming it is RHEL or similar, the command would be based on lvreduce

You can use a selection of flags, the most important one is -r which deals with the filesystem residing on the logical volume. This will unmount it, coalesce the files to the early par of the filesystem and then reduce the size. It then reduces the size of the logical volume and remounts the filesystem.

Depending on how large, how full and how fragmented the filesystem is, it can take a while to run.

Other options that are very common would be -l or -L, lower and upper case L which set the size. The manual page will give you the details on how to use each.

So, your eventual command might become:-
Code:
lvreduce -r -L 20G /dev/mapper/vg_data-lv_stockbook


Does this help?

Robin

Last edited by rbatte1; 02-14-2017 at 05:03 AM.. Reason: Added a welcome for the new member
This User Gave Thanks to rbatte1 For This Post:
# 3  
Old 02-14-2017
Linux Shrink ext4 filesystem and reduce the size of a Logical Volume in Linux

Hello,
I know very quick and safe method to shrink ext2, ext3 and ext4 filesystem and reduce the size of a Logical Volume with basically just one command.
Please watch it here:
Shrink ext2 ext3 and ext4 file system and reduce the size of a logical volume with only one command. - YouTube

Thanks.
This User Gave Thanks to R3dh4t_guru For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

[ASK] decrease/shrink the size of filesystem

Hello, I would like to reduce the size of filesystem online. We can do online for increase without any problem. So any risk can be occurred with the decrease? This is not an issue, just a discussion for decrease/shrink space with chfs command. My AIX system is version 6.1 and the filesystem... (2 Replies)
Discussion started by: Phat
2 Replies

2. AIX

Increase filesystem and or logical volume

Hi all, Do i need to increase the logical volume each time i increase the filesystem? or is enough to increase the filesystem and the logical volume get increase automatically? extendlv hd4 1 chfs -a size=2G /tmp or just chfs -a size=2G /tmp Code tags! (4 Replies)
Discussion started by: prpkrk
4 Replies

3. UNIX for Dummies Questions & Answers

Filesystem not using all available space in Logical Volume

I am running HP-UX 11.31 ia64. The /usr filesystem shows 7 GB as the size, but the logical volume that is mounted there shows 13 GB. Is there a way to get the entire 13 GB to show up and why did this happen in the first place? (11 Replies)
Discussion started by: trojan28
11 Replies

4. UNIX for Dummies Questions & Answers

Unable to reduce the size of volume group?

My volume group of size 200 gb. out of which only 100 gb is used by 2 logical volumes /dev/vg00/lvol0 and /dev/vg00/lvol0 respectively (both are 50 gb each). Whenever i use vgreduce command to reduce the size of volume group i get below error. # vgreduce vg00 -a Physical volume... (16 Replies)
Discussion started by: pinga123
16 Replies

5. HP-UX

Unable To Extend the Size of a Logical Volume File System

Background: # uname -a HP-UX deedee B.11.23 U ia64 4294967295 unlimited-user license deedee.rsn.hp.com:/ # bdf /opt Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol6 6553600 6394216 158144 98% /opt /opt is almost full... (3 Replies)
Discussion started by: Rob Sandifer
3 Replies

6. Linux

Backup of 20 GB Logical Volume in Linux

Hi, i want to know the commands that can be used for taking the backup of 20GB logical volume in a linux machine. Thanks & Regards Arun (3 Replies)
Discussion started by: Arun.Kakarla
3 Replies

7. AIX

Basic Filesystem / Physical Volume / Logical Volume Check

Hi! Can anyone help me on how I can do a basic check on the Unix filesystems / physical volumes and logical volumes? What items should I check, like where do I look at in smit? Or are there commands that I should execute? I need to do this as I was informed by IBM that there seems to be... (1 Reply)
Discussion started by: chipahoys
1 Replies

8. AIX

logical volume and filesystem

explain about logical volume and filesystem thanks for your replay (1 Reply)
Discussion started by: chomca
1 Replies

9. Solaris

How to reduce the size of a logical volume in solaris 9

Hi, I have the following problem. I just have a new machine with mirroring. The logical volume for /opt is dimensionned to 75 GB which is to much. I want a volume of 10 GB. How can I reduce the size ? I tried to reduce the size of the slice from 75 GB to 10 GB, but the size of the logical volume... (6 Replies)
Discussion started by: aribault
6 Replies
Login or Register to Ask a Question