My system is fully encrypted with dm-crypt and LVM. I recently moved the encrypted partition from /dev/sda5 to /dev/sda2.

My question is: how can I change the name the encrypted partition is mapped to from sda5_crypt to sda2_crypt?

I can boot the system all right. But the prompt I get at boot time says (sda5_crypt) though the UUID maps to /dev/sda2:

  Volume group "vg" not found
  Skipping volume group vg
Unlocking the disk /dev/.../UUID  (sda5_crypt)
Enter passphrase:

I tried to live-boot, decrypt sda2, activate vg, chroot to /dev/vg/root and run update-grub2 but to no avail.

Merely editing /etc/crypttab doesn't work either.

  • Have you recreated the initrd after editing /etc/crypttab? Jun 28, 2013 at 12:53
  • I think so: update-initramfs -t -u -k all
    – n.r.
    Jun 28, 2013 at 12:59
  • Output of grep -r sda5_crypt /etc? Jun 28, 2013 at 13:04
  • Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.
    – n.r.
    Jun 28, 2013 at 13:36
  • Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered. Jun 28, 2013 at 13:48

2 Answers 2


"sda5_crypt" crypttab change as per suggestion below:

Replace OLD_NAME with NEW_NAME in /etc/crypttab & /etc/fstab, and then:

# dmsetup rename OLD_NAME NEW_NAME
# cp -a /dev/mapper/NEW_NAME /dev/mapper/OLD_NAME
# update-initramfs -u -k all
# rm /dev/mapper/OLD_NAME
# update-grub
# reboot
  • 2
    rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use. Jun 28, 2013 at 18:29
  • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands. Jun 28, 2013 at 22:45
  • 1
    @Gilles: sure, but the question stated "I can boot the system all right." Jun 29, 2013 at 11:29
  • You just saved me a big headache @n.r. Thank you
    – deitch
    May 6, 2016 at 10:38
  • 1
    This is the right method, but a few more details should be pointed out: 1) Don't forget to update /etc/fstab before these commands, too, or you're root partition won't mount. 2) You may receive an error on update-grub that it can't find the previous name. Assuming you're only renaming the crypt name, then you can ignore the error, reboot, and run update-grub after you boot up.
    – Fmstrat
    Mar 15, 2019 at 14:45

I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:

  1. Boot a Live (K)Ubuntu System from USB
  2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password
  3. Open the console in the root directory of your broken system
  4. Execute the following line by line
sudo -s
# get the name the partition was mounted with, starts with luks
dmsetup ls
# rename the loop device (check with ls /dev/mapper)
dmsetup rename LUKS_NAME NEW_NAME

# prepare chroot
mount --bind /dev dev/
mount --bind /proc proc/
mount --bind /sys sys/
chroot .

# mount devices (I missed this first, you need both)
mount boot
mount /

# ready to update
update-initramfs -u -k all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.