How to clone /boot and LUKS-encrypted root partitions to a new disk with a different partition table
The system in question is installed on an 80GB HDD that's on its last legs. Partition table is msdos, and has a /boot
partition, and encrypted swap
and /
partitions. The swap is no longer used so I'd prefer to ditch this as I go.
The disk I have to replace it is a 6TB WD Red, and due to its size I need to use gpt, so I can't just dd
the entire disk. I'd like it to have the same size /boot
partition and just have the remainder be an encrypted /
partition.
I've had this system running well for quite some time and since then I've completely lost track of every last thing I did to get it the way it is, so hopefully I have an option available beyond "reinstall and start over". Thanks!
14.04 boot grub2 partitioning encryption
add a comment |
The system in question is installed on an 80GB HDD that's on its last legs. Partition table is msdos, and has a /boot
partition, and encrypted swap
and /
partitions. The swap is no longer used so I'd prefer to ditch this as I go.
The disk I have to replace it is a 6TB WD Red, and due to its size I need to use gpt, so I can't just dd
the entire disk. I'd like it to have the same size /boot
partition and just have the remainder be an encrypted /
partition.
I've had this system running well for quite some time and since then I've completely lost track of every last thing I did to get it the way it is, so hopefully I have an option available beyond "reinstall and start over". Thanks!
14.04 boot grub2 partitioning encryption
add a comment |
The system in question is installed on an 80GB HDD that's on its last legs. Partition table is msdos, and has a /boot
partition, and encrypted swap
and /
partitions. The swap is no longer used so I'd prefer to ditch this as I go.
The disk I have to replace it is a 6TB WD Red, and due to its size I need to use gpt, so I can't just dd
the entire disk. I'd like it to have the same size /boot
partition and just have the remainder be an encrypted /
partition.
I've had this system running well for quite some time and since then I've completely lost track of every last thing I did to get it the way it is, so hopefully I have an option available beyond "reinstall and start over". Thanks!
14.04 boot grub2 partitioning encryption
The system in question is installed on an 80GB HDD that's on its last legs. Partition table is msdos, and has a /boot
partition, and encrypted swap
and /
partitions. The swap is no longer used so I'd prefer to ditch this as I go.
The disk I have to replace it is a 6TB WD Red, and due to its size I need to use gpt, so I can't just dd
the entire disk. I'd like it to have the same size /boot
partition and just have the remainder be an encrypted /
partition.
I've had this system running well for quite some time and since then I've completely lost track of every last thing I did to get it the way it is, so hopefully I have an option available beyond "reinstall and start over". Thanks!
14.04 boot grub2 partitioning encryption
14.04 boot grub2 partitioning encryption
edited Mar 10 '16 at 22:44
polyisoprene
asked Mar 10 '16 at 5:55
polyisoprenepolyisoprene
13
13
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Spent a couple hours testing everything and it all works exactly the same as before, so I'm calling this solved, and since I just found out that not only can I answer my own question but I'm encouraged to, here it is:
- Boot to live USB and install Xubuntu onto the new drive from scratch, creating new partitions as desired but being sure to use the exact same username, pw, &c as the original.
- Run
update
,dist-upgrade
,clean
andautoremove
inapt-get
on the new installation. - Reboot to old HDD, run same updates on old install
Reboot to live USB, run
lsblk
to check which is where, then:
apt-get install cryptsetup
cryptsetup luksOpen /dev/[old root partition] [old partition's name]
cryptsetup luksOpen /dev/[new root partition] [new partition's name]
mount /dev/mapper/[old partition's name] /mnt/oldroot
mount /dev/mapper/[new partition's name] /mnt/root
cp /mnt/root/etc/fstab [somewhere safe]
cp -axfv /mnt/oldroot/* /mnt/root
cp [somewhere safe]/fstab /mnt/root/etc/
shut down, disconnect the old drive and the live USB, and boot to the new drive
Unlike what other answers to similar questions suggest I found there's no need to mount either boot partition from the live USB, nor any need to bother with mount -B
/chroot
/update-grub
, and no need to touch fstab
except to back it up and restore it. Surprised it worked since this was a shot at the dark at 3am, but it did. Hopefully this helps someone else down the line!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f744158%2fhow-to-clone-boot-and-luks-encrypted-root-partitions-to-a-new-disk-with-a-diffe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Spent a couple hours testing everything and it all works exactly the same as before, so I'm calling this solved, and since I just found out that not only can I answer my own question but I'm encouraged to, here it is:
- Boot to live USB and install Xubuntu onto the new drive from scratch, creating new partitions as desired but being sure to use the exact same username, pw, &c as the original.
- Run
update
,dist-upgrade
,clean
andautoremove
inapt-get
on the new installation. - Reboot to old HDD, run same updates on old install
Reboot to live USB, run
lsblk
to check which is where, then:
apt-get install cryptsetup
cryptsetup luksOpen /dev/[old root partition] [old partition's name]
cryptsetup luksOpen /dev/[new root partition] [new partition's name]
mount /dev/mapper/[old partition's name] /mnt/oldroot
mount /dev/mapper/[new partition's name] /mnt/root
cp /mnt/root/etc/fstab [somewhere safe]
cp -axfv /mnt/oldroot/* /mnt/root
cp [somewhere safe]/fstab /mnt/root/etc/
shut down, disconnect the old drive and the live USB, and boot to the new drive
Unlike what other answers to similar questions suggest I found there's no need to mount either boot partition from the live USB, nor any need to bother with mount -B
/chroot
/update-grub
, and no need to touch fstab
except to back it up and restore it. Surprised it worked since this was a shot at the dark at 3am, but it did. Hopefully this helps someone else down the line!
add a comment |
Spent a couple hours testing everything and it all works exactly the same as before, so I'm calling this solved, and since I just found out that not only can I answer my own question but I'm encouraged to, here it is:
- Boot to live USB and install Xubuntu onto the new drive from scratch, creating new partitions as desired but being sure to use the exact same username, pw, &c as the original.
- Run
update
,dist-upgrade
,clean
andautoremove
inapt-get
on the new installation. - Reboot to old HDD, run same updates on old install
Reboot to live USB, run
lsblk
to check which is where, then:
apt-get install cryptsetup
cryptsetup luksOpen /dev/[old root partition] [old partition's name]
cryptsetup luksOpen /dev/[new root partition] [new partition's name]
mount /dev/mapper/[old partition's name] /mnt/oldroot
mount /dev/mapper/[new partition's name] /mnt/root
cp /mnt/root/etc/fstab [somewhere safe]
cp -axfv /mnt/oldroot/* /mnt/root
cp [somewhere safe]/fstab /mnt/root/etc/
shut down, disconnect the old drive and the live USB, and boot to the new drive
Unlike what other answers to similar questions suggest I found there's no need to mount either boot partition from the live USB, nor any need to bother with mount -B
/chroot
/update-grub
, and no need to touch fstab
except to back it up and restore it. Surprised it worked since this was a shot at the dark at 3am, but it did. Hopefully this helps someone else down the line!
add a comment |
Spent a couple hours testing everything and it all works exactly the same as before, so I'm calling this solved, and since I just found out that not only can I answer my own question but I'm encouraged to, here it is:
- Boot to live USB and install Xubuntu onto the new drive from scratch, creating new partitions as desired but being sure to use the exact same username, pw, &c as the original.
- Run
update
,dist-upgrade
,clean
andautoremove
inapt-get
on the new installation. - Reboot to old HDD, run same updates on old install
Reboot to live USB, run
lsblk
to check which is where, then:
apt-get install cryptsetup
cryptsetup luksOpen /dev/[old root partition] [old partition's name]
cryptsetup luksOpen /dev/[new root partition] [new partition's name]
mount /dev/mapper/[old partition's name] /mnt/oldroot
mount /dev/mapper/[new partition's name] /mnt/root
cp /mnt/root/etc/fstab [somewhere safe]
cp -axfv /mnt/oldroot/* /mnt/root
cp [somewhere safe]/fstab /mnt/root/etc/
shut down, disconnect the old drive and the live USB, and boot to the new drive
Unlike what other answers to similar questions suggest I found there's no need to mount either boot partition from the live USB, nor any need to bother with mount -B
/chroot
/update-grub
, and no need to touch fstab
except to back it up and restore it. Surprised it worked since this was a shot at the dark at 3am, but it did. Hopefully this helps someone else down the line!
Spent a couple hours testing everything and it all works exactly the same as before, so I'm calling this solved, and since I just found out that not only can I answer my own question but I'm encouraged to, here it is:
- Boot to live USB and install Xubuntu onto the new drive from scratch, creating new partitions as desired but being sure to use the exact same username, pw, &c as the original.
- Run
update
,dist-upgrade
,clean
andautoremove
inapt-get
on the new installation. - Reboot to old HDD, run same updates on old install
Reboot to live USB, run
lsblk
to check which is where, then:
apt-get install cryptsetup
cryptsetup luksOpen /dev/[old root partition] [old partition's name]
cryptsetup luksOpen /dev/[new root partition] [new partition's name]
mount /dev/mapper/[old partition's name] /mnt/oldroot
mount /dev/mapper/[new partition's name] /mnt/root
cp /mnt/root/etc/fstab [somewhere safe]
cp -axfv /mnt/oldroot/* /mnt/root
cp [somewhere safe]/fstab /mnt/root/etc/
shut down, disconnect the old drive and the live USB, and boot to the new drive
Unlike what other answers to similar questions suggest I found there's no need to mount either boot partition from the live USB, nor any need to bother with mount -B
/chroot
/update-grub
, and no need to touch fstab
except to back it up and restore it. Surprised it worked since this was a shot at the dark at 3am, but it did. Hopefully this helps someone else down the line!
answered Mar 10 '16 at 22:45
polyisoprenepolyisoprene
13
13
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f744158%2fhow-to-clone-boot-and-luks-encrypted-root-partitions-to-a-new-disk-with-a-diffe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown