I made a mistake of encrypting the entire LVM physical volume (contains both home, root, and swap) when installing a CentOS 6.4 (2.6.32-358.6.1.el6.x86_64) box. I soon came to realize that moving files takes a horrendous amount of time due to kcryptd running at 90% of CPU and that encryption was not really necessary as it's just a home server containing no crucial data. However, I already configured it and installed loads of packages, tuned it as far as power management goes, and set up all the services.Is there any way to remove the encryption without having to re-install the whole thing and go through the configuration all over again? I'd love an option that would take less than 30 mins but I'm not sure one exists.Also, if anyone has any recommendations on how to make kcryptd more easy to use, let me know.Edit 1~]# fdisk -l /dev/sdaDisk /dev/sda: 160.0 GB, 160041885696 bytes255 heads, 63 sectors/track, 19457 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000078c9   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          64      512000   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              64       19458   155777024   83  Linux~]# dmsetup lsvg_centos-lv_home       (253:3)vg_centos-lv_swap       (253:2)vg_centos-lv_root       (253:1)luks-2ffcc00c-6d6e-401c-a32c-9c82995ad372       (253:0)~]# pvdisplay  --- Physical volume ---  PV Name               /dev/mapper/luks-2ffcc00c-6d6e-401c-a32c-9c82995ad372  VG Name               vg_centos  PV Size               148.56 GiB / not usable 4.00 MiB  Allocatable           yes (but full)  PE Size               4.00 MiB  Total PE              38030  Free PE               0  Allocated PE          38030  PV UUID               euUB66-TP3M-ffKp-WhF5-vKI5-obqK-0qKoyZEdit 2~]# df -h / /home /bootFilesystem            Size  Used Avail Use% Mounted on/dev/mapper/vg_centos-lv_root                       50G  2.3G   45G   5% //dev/mapper/vg_centos-lv_home                       94G  1.3G   88G   2% /home/dev/sda1             485M   53M  408M  12% /boot
What's the easiest way to decrypt a disk partition?
linux;centos;lvm;encryption;disk
That is possible. It requiresanother Linux to boot (CD/DVD is OK)some spare space outside the PV (100M would be good)a certain amount of fearlessness...Then you copy a block from the encrypted volume to the area outside the PV and (after success) to the unencrypted base device. After that you increase a counter in the safe area so that you can continue the transformation in case of a crash. Depending on the kind of encryption it may be necessary (or at least useful) to copy from the end of the block device to the beginning.If this is an option for you then I can offer some code.Edit 1Deactivate the swap partition (comment it out in etc/fstab). Then boot another Linux (from CD/DVD) and open the LUKS volume (cryptsetup luksOpen /dev/sda2 lukspv) but don't mount the LVs. Maybe you need run pvscan afterwards to that the decrypted device is recogniced. Then vgchange -ay vg_centos may be necessary to activate the volumes. As soon as they are you can reduce the file systems in them:e2fsck -f /dev/mapper/vg_centos-lv_rootresize2fs -p /dev/mapper/vg_centos-lv_root 3000Me2fsck -f /dev/mapper/vg_centos-lv_homeresize2fs -p /dev/mapper/vg_centos-lv_home 2000MAfter that you can reduce the size of the LVs (and delete the swap LV):# with some panic reserve... shouldn't be necessarylvresize --size 3100M /dev/mapper/vg_centos-lv_rootlvresize --size 2100M /dev/mapper/vg_centos-lv_homelvremove /dev/mapper/vg_centos-lv_swap# vgdisplay should show now that most of the VG is free spacevgdisplayNow the PV can be reduced (exciting, I have never done this myself ;-) ):vgchange -an vg_centospvresize --setphysicalvolumesize 5500M /dev/mapper/lukspvEdit: Maybe pvmove is needed before pvresize can be called. In case of an error see this question.Before you reduce the partition size you should make a backup of the partition table and store it on external storage.sfdisk -d /dev/sda >sfdisk_dump_sda.txtYou can use this file for reducing the size of the LUKS partition. Adapt the size (in sectors) to about 6 GiB (panic reserve again...): 12582912. Then load the adapted file:sfdisk /dev/sda <sfdisk_dump_sda.mod.txtIf everything looks good after rebooting you can create a new partition in the free space (at best not consuming all the space, you probably know why meanwhile...) and make it an LVM partition. Then make the partition a LVM PV (pvcreate), create a new volume group (vgcreate) and logical volumes for root, home and swap (lvcreate) and format them (mke2fs -t ext4, mkswap). Then you can copy the contents of the opened crypto volumes. Finally you have to reconfigure your boot loader so that it uses the new rootfs.The block copying I mentioned in the beginning is not necessary due to the large amount of free space.