Answer the question
In order to leave comments, you need to log in
How to increase free space for a partition in LVM?
I can’t figure out how to increase the free space for the /var directory:
11M is available there, but it’s not clear how to increase it :(
Answer the question
In order to leave comments, you need to log in
Check vgdisplay for Free PE. If 0 - there is simply nothing to expand.
If there is free, then lvresize or lvextend. Then expand the file system (resize2fs for ext2/3/4 which you probably already have)
If free is not available, then you need to add a new disk or reduce other partitions. For example, /home . However, judging by its size and 45MB used, you cut the disk incorrectly for your task (why did you cut /var and /home separately at all?). Maybe it would be better to completely remount the /home partition somewhere, copy the data to the root /home and delete this volume completely.
If you need a separate / home - then again resize2fs or whatever file system you have there. Compress to some size (if possible), check that it is compressed, then reduce the logical volume (lvresize). It makes sense to ask resize2fs to be less than the size you want to shrink the partition. then, after lvresize, call resize2fs again and expand the partition back - so as not to accidentally make a mistake by a couple of megabytes and not damage the file system.
We increase the volume on which /var lies We
increase the file system under /var
We rejoice ...
I once wrote an instruction:
Expanding the disk using LVM We
format the added device. I'll omit the fdisk output. Use the 'o' subcommand to create a new partition table, then the 'n' subcommand to create a new partition. If the partition is the only one, fdisk itself substitutes the necessary sector numbers and assigns the type itself - 0x83 (Linux). To change the partition type to 0x8e (Linux LVM) use the 't' subcommand. The 'w' subcommand is used to write the partition table to disk. The partition table only needs to be created if a completely new, unformatted drive is being used.
Create a new physical volume to add it to LVM:
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
# vgdisplay
--- Volume group ---
VG Name vg_windycat
# vgextend vg_windycat /dev/sdb1
Volume group "vg_windycat" successfully extended
# lvscan
ACTIVE '/dev/vg_windycat/lv_swap' [4.69 GiB] inherit
ACTIVE '/dev/vg_windycat/lv_tmp' [4.00 GiB] inherit
ACTIVE '/dev/vg_windycat/lv_root' [39.06 GiB] inherit
ACTIVE '/dev/vg_windycat/lv_home' [51.76 GiB] inherit
# lvextend /dev/vg_windycat/lv_tmp /dev/sdb1
Size of logical volume vg_windycat/lv_tmp changed from 4.00 GiB (1024 extents) to 24.00 GiB (6143 extents).
Logical volume lv_tmp successfully resized
# resize2fs /dev/vg_windycat/lv_tmp
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_windycat/lv_tmp is mounted on /tmp; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_windycat/lv_tmp to 6290432 (4k) blocks.
The filesystem on /dev/vg_windycat/lv_tmp is now 6290432 blocks long.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question