2

Here are my partitions:

[awake@desktop ~]$ sudo df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 36G  2.5G   33G   8% /
udev                  495M     0  495M   0% /dev
tmpfs                 502M  260K  502M   1% /dev/shm
tmpfs                 502M  748K  501M   1% /run
/dev/mapper/vg_desktop-lv_root
                       36G  2.5G   33G   8% /
tmpfs                 502M     0  502M   0% /sys/fs/cgroup
tmpfs                 502M     0  502M   0% /media
/dev/sda1             485M   50M  410M  11% /boot
/dev/mapper/vg_desktop-lv_home
                       36G   20G   15G  59% /home
/dev/mapper/vg_desktop-lv_root
                       36G  2.5G   33G   8% /tmp
/dev/mapper/vg_desktop-lv_root
                       36G  2.5G   33G   8% /var/tmp
/dev/mapper/vg_desktop-lv_home
                       36G   20G   15G  59% /home
/dev/sdb5             932G  637G  295G  69% /media/Новый том

So I have no any free space. How to send a part of / partitions size to /home in encrypted lvm without data loosing?

Coops
  • 5,967
  • 1
  • 31
  • 52
Clark
  • 347
  • 2
  • 5
  • 13

1 Answers1

4

To shrink a filesystem to XX GB, you might want to follow these steps :

  • umount the filesystem you want to shrink
  • Run a fsck on the filesystem
  • Resize the filesystem with resize2fs /dev/blah XXG
  • lvreduce -L XXG /dev/blah

Then you can extend the other filesystem online : - lvextend -L YYG /dev/blah - resize2fs /dev/blah

That should make it, of course if you want to shrink /, you can boot on a live CD/USB key :)

MunsterNet
  • 454
  • 2
  • 3
  • Thanks and can be done without any free space on disk (I mean that whole disk is parted)? So at first I need to decrease / size with fsck&resize2fs&lvreduct and after increase with this method /home to? – Clark Aug 24 '11 at 12:50
  • 1
    Yes, it should work while you have / and /home under the same volume group. If that's not the case, you'll also have to reduce the VG attached to / and then extend the VG attached to /home prior to extending the /home partition – MunsterNet Aug 24 '11 at 12:56
  • 1
    For some tips on how to safely reduce the size of an LVM-based filesystem, see http://serverfault.com/questions/279571/lvm-dangers-and-caveats/279577#279577 - this is more error prone than enlarging an FS. Make sure you have a good backup before you resize, it's quite easy to wipe out entire LVs if not done correctly. – RichVel Aug 24 '11 at 14:49