I have an encrypted crypt-luks partition that is currently named sda3, and is the last partition on the disk, that is, there are no sda4 or sda5. The encrypted partition contains three logical volumes containing the filesystem.Is there anyway I can rename the partition from sda3 to sda5? This is a new installation, and I don't mind losing data. I'll be using a recovery USB stick to renumber the partition if this is at all possible.I tried using gdisk with the advanced mode, and renamed the disk using the t option. Now however I cannot boot from the disk: It asks for the encryption password and loops back when entered. What is the correct way of doing this?(For those curious, I need this is due to an automatic script that expects my encrypted partition to be on sda5. Unfortunately, the script is run at boot over a network, and I don't have control over it.)
Renumber encrypted partition - sda3 to sda5
partition;lvm;luks
The following solution is based on the forum posting udev rule for a symlinkYou have /dev/sda3 and you want to create a symlink to it to synthesise an entry for the missing device named /dev/sda5:cd /dev && ln -s sda3 sda5This can be managed at boot time within udev with a simple rule that matches the block device sda3.Create the file /etc/udev/rules.d/80-local, or use a similarly named file, and add these lines to it:# symlink existing /dev/sda3 to new sda5SUBSYSTEM==block, KERNEL==sda3 SYMLINK+=sda5In case you're curious, I picked the SUBSYSTEM and KERNEL values as suitable matches by reviewing the output of udevadm info -a -n /dev/sda3. (I would have preferred to match on a UUID or other unique identifier but I couldn't find one.)Now tell udev to reload its rules and trigger any new matches:udevadm control --reload-rulesudevadm trigger --attr-match=subsystem=blockand you will see the symlink automatically created:ls -l /dev/sda5lrwxrwxrwx 1 root root    4 Jan  7 17:18 /dev/sda5 -> sda3I have not been able to test this next step, but depending on where in the boot process you need this symlink to be created you may find it's necessary to update your initramfs. On my Debian system that's done like this:update-initramfs -u