0

I want to extend my Encrypted LVM to the adjacent free space, I tried https://help.ubuntu.com/community/ResizeEncryptedPartitions in VirtualBox and find that if the adjacent free space is in the front of LVM all data will be lost if you do the extending with the fdisk follow the article, so will I need to move the partition to the front of the free space before I enlarge the real disk? How do that or do you have advice?

4
  • The article applies to a regular installation, not a virtual machine. Your virtual machine is just a file on the main disk. You need to consult the VirtualBox documentation on how to extend the VM.
    – user680858
    Jun 19, 2017 at 5:09
  • I'm not sure how the potential risk is so I tried the commands in VirtualBox, then I learned something from the commands in VirtualBox, that I can't put my free space in front of LVM (viewed by the GParted list of disk is front) no matter in the real disk or virtualBox disk, but I have no idea to move the freespace to the back of the end of LVM.
    – viropuxa
    Jun 19, 2017 at 16:17
  • I'm not sure how the potential risk is so I tried the commands in VirtualBox, then I learned something from the commands in VirtualBox, that I can't put my free space in front of LVM (viewed by the GParted list of disk is front) no matter in the real disk or virtualBox disk, but I have no idea to move the freespace to the back of the end of LVM.
    – viropuxa
    Jun 19, 2017 at 16:19
  • You already described the potential risk: you can lose all data! So make sure you have a backup of it before "trying" command's. Show a screenshot of the physical disk layout and the layout of the LVM.
    – user680858
    Jun 20, 2017 at 6:24

1 Answer 1

0

You can use KDE Partition Manager 3.0 (available on 17.04) which supports LVM. Moving partitions is not really possible from command line.

Tools like GParted or KDE Partition Manager have some own code to copy data to another place in disk, they don't use libparted for that.

5
  • Can I just copy some files (maybe they are tiny) which describe the partition as encrypted one and move them to the precious unallocated space (maybe start sector) and then the boot-loader detects the new partition as encrypted LVM so passphrase comfirmation? But I don't know if how can you help?
    – viropuxa
    Jun 22, 2017 at 17:08
  • GParted uses libparted underneath. Hence their similar name. Jun 23, 2017 at 8:39
  • Yes, I can move the encrypted LVM to left with KDE Partition Manager, I will try later enlarge my LVM with fdisk.Thank you a lot!
    – viropuxa
    Jun 23, 2017 at 11:10
  • @viropuxa, why not finish the task with KDE Partition Manager? fdisk can be used to enlarge partitions but then you also need to run pvresize etc... Jun 27, 2017 at 14:19
  • @David Foerster Both GParted and KDE Partition Manager use libparted only for a fairly limited subset of tasks. Moving and resizing partitions (except fat and I think hfs), formatting and checking file systems is done using third party tools and libparted is not involved. E.g. in KDE Partition Manager's kpmcore library that has partition operations only about 60 KiB of code deals with libparted out of more than 1 MiB. Jun 27, 2017 at 14:24

Not the answer you're looking for? Browse other questions tagged .