encrypted drive cloning - expanding partitions problem
I'm trying to clone my SDD to a larger device so I will have a bootable backup in anticipation of doing a system upgrade on several desktop clients. I also want to model a known-correct procedure to see if I can reliably clone my system drives to a larger HDD/SDD (so far all attempts to do this in the past have failed). Currently running 16.04 LTS which was built using the fully encrypted disk option. The test system being used is running fine.
I followed several procedures I found on this site but none worked. I hit a dead end with each procedure. So to simplify things, I did the following:
sudo dd if=/dev/sda of=/dev/sdd bs=64k
Opened GParted and deleted the old crypt-luks partition on /dev/sdd as instructed in the procedure posted at Cloning Encrypted SSD to larger SSD. This was a mistake and I was dead in the water from here on. I was unable to create a new crypt-luks partition.
So an answer that explains how to [re]create/resize the crypt-luks partition on the new target drive would be very helpful.
I repeated the dd and tried expanding the target filesystem with the following commands (using LiveCD):
sudo cryptsetup luksOpen /dev/sda5 sda5_crypt
sudo cryptsetup resize sda5_crypt
sudo modprobe dm-crypt
sudo vgscan --mknodes
sudo vgchange -ay
sudo pvresize /dev/mapper/sda5_crypt
sudo lvresize -l +100%FREE /dev/ubuntu-vg/root
returns: New size (7020 extents) matches existing size (7020 extents).
sudo pvchange -x n /dev/mapper/sda5_crypt
returns:
Physical volume "/dev/mapper/sda5_crypt" is already unallocatable.
Physical volume /dev/mapper/sda5_crypt not changed
0 physical volumes changed / 1 physical volume not changed
sudo e2fsck -f /dev/mapper/ubuntu--vg-root
Returns:
Pass 5: Checking group summary information
/dev/mapper/ubuntu--vg-root: 296641/1798720 files (0.8% non-contiguous), 3525828/7188480 blocks
The source SDD was 32Gb and the HDD I am trying to expand is 80 Gb
sudo resize2fs -f /dev/mapper/ubuntu--vg-root
Returns:
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 7188480 (4k) blocks long. Nothing to do!
So it appears that the procedure did not expand the partitions. This is verified by rebooting and running GParted which shows the same partitioning before and after:
I've been at this for many days doing research and trying to get this to work and I'm starting to get tunnel vision. I would VERY much appreciate someone posting a bullet-proof procedure that is known to work in cloning encrypted HDDs/SDDs to larger storage devices.
This is NOT a duplicate question. The several answers I found on here did not work for me. And all of those answers contained multiple comments posted by others who tried those procedures and failed.
The target dd drive will indeed boot without expanding any partitions.
My primary question is really much more about expanding encrypted file systems than it is about cloning them. Although these two tasks are obviously very closely related. A bullet-proof, scaleable, reliably repeatable procedure that explains how to do both would be extremely helpful. The procedure https://help.ubuntu.com/community/ResizeEncryptedPartitions is a bit too complex for me to follow although I believe I ran the procedure correctly. It's probably very close to what I need but may be missing a step or two.
It seems to me that simply expanding the encrypted partitions on a properly cloned device ought not require more than several commands. Ideally, this is something easily done using GParted.
Many thanks in advance.
16.04 encryption cryptsetup cloning
add a comment |
I'm trying to clone my SDD to a larger device so I will have a bootable backup in anticipation of doing a system upgrade on several desktop clients. I also want to model a known-correct procedure to see if I can reliably clone my system drives to a larger HDD/SDD (so far all attempts to do this in the past have failed). Currently running 16.04 LTS which was built using the fully encrypted disk option. The test system being used is running fine.
I followed several procedures I found on this site but none worked. I hit a dead end with each procedure. So to simplify things, I did the following:
sudo dd if=/dev/sda of=/dev/sdd bs=64k
Opened GParted and deleted the old crypt-luks partition on /dev/sdd as instructed in the procedure posted at Cloning Encrypted SSD to larger SSD. This was a mistake and I was dead in the water from here on. I was unable to create a new crypt-luks partition.
So an answer that explains how to [re]create/resize the crypt-luks partition on the new target drive would be very helpful.
I repeated the dd and tried expanding the target filesystem with the following commands (using LiveCD):
sudo cryptsetup luksOpen /dev/sda5 sda5_crypt
sudo cryptsetup resize sda5_crypt
sudo modprobe dm-crypt
sudo vgscan --mknodes
sudo vgchange -ay
sudo pvresize /dev/mapper/sda5_crypt
sudo lvresize -l +100%FREE /dev/ubuntu-vg/root
returns: New size (7020 extents) matches existing size (7020 extents).
sudo pvchange -x n /dev/mapper/sda5_crypt
returns:
Physical volume "/dev/mapper/sda5_crypt" is already unallocatable.
Physical volume /dev/mapper/sda5_crypt not changed
0 physical volumes changed / 1 physical volume not changed
sudo e2fsck -f /dev/mapper/ubuntu--vg-root
Returns:
Pass 5: Checking group summary information
/dev/mapper/ubuntu--vg-root: 296641/1798720 files (0.8% non-contiguous), 3525828/7188480 blocks
The source SDD was 32Gb and the HDD I am trying to expand is 80 Gb
sudo resize2fs -f /dev/mapper/ubuntu--vg-root
Returns:
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 7188480 (4k) blocks long. Nothing to do!
So it appears that the procedure did not expand the partitions. This is verified by rebooting and running GParted which shows the same partitioning before and after:
I've been at this for many days doing research and trying to get this to work and I'm starting to get tunnel vision. I would VERY much appreciate someone posting a bullet-proof procedure that is known to work in cloning encrypted HDDs/SDDs to larger storage devices.
This is NOT a duplicate question. The several answers I found on here did not work for me. And all of those answers contained multiple comments posted by others who tried those procedures and failed.
The target dd drive will indeed boot without expanding any partitions.
My primary question is really much more about expanding encrypted file systems than it is about cloning them. Although these two tasks are obviously very closely related. A bullet-proof, scaleable, reliably repeatable procedure that explains how to do both would be extremely helpful. The procedure https://help.ubuntu.com/community/ResizeEncryptedPartitions is a bit too complex for me to follow although I believe I ran the procedure correctly. It's probably very close to what I need but may be missing a step or two.
It seems to me that simply expanding the encrypted partitions on a properly cloned device ought not require more than several commands. Ideally, this is something easily done using GParted.
Many thanks in advance.
16.04 encryption cryptsetup cloning
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28
add a comment |
I'm trying to clone my SDD to a larger device so I will have a bootable backup in anticipation of doing a system upgrade on several desktop clients. I also want to model a known-correct procedure to see if I can reliably clone my system drives to a larger HDD/SDD (so far all attempts to do this in the past have failed). Currently running 16.04 LTS which was built using the fully encrypted disk option. The test system being used is running fine.
I followed several procedures I found on this site but none worked. I hit a dead end with each procedure. So to simplify things, I did the following:
sudo dd if=/dev/sda of=/dev/sdd bs=64k
Opened GParted and deleted the old crypt-luks partition on /dev/sdd as instructed in the procedure posted at Cloning Encrypted SSD to larger SSD. This was a mistake and I was dead in the water from here on. I was unable to create a new crypt-luks partition.
So an answer that explains how to [re]create/resize the crypt-luks partition on the new target drive would be very helpful.
I repeated the dd and tried expanding the target filesystem with the following commands (using LiveCD):
sudo cryptsetup luksOpen /dev/sda5 sda5_crypt
sudo cryptsetup resize sda5_crypt
sudo modprobe dm-crypt
sudo vgscan --mknodes
sudo vgchange -ay
sudo pvresize /dev/mapper/sda5_crypt
sudo lvresize -l +100%FREE /dev/ubuntu-vg/root
returns: New size (7020 extents) matches existing size (7020 extents).
sudo pvchange -x n /dev/mapper/sda5_crypt
returns:
Physical volume "/dev/mapper/sda5_crypt" is already unallocatable.
Physical volume /dev/mapper/sda5_crypt not changed
0 physical volumes changed / 1 physical volume not changed
sudo e2fsck -f /dev/mapper/ubuntu--vg-root
Returns:
Pass 5: Checking group summary information
/dev/mapper/ubuntu--vg-root: 296641/1798720 files (0.8% non-contiguous), 3525828/7188480 blocks
The source SDD was 32Gb and the HDD I am trying to expand is 80 Gb
sudo resize2fs -f /dev/mapper/ubuntu--vg-root
Returns:
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 7188480 (4k) blocks long. Nothing to do!
So it appears that the procedure did not expand the partitions. This is verified by rebooting and running GParted which shows the same partitioning before and after:
I've been at this for many days doing research and trying to get this to work and I'm starting to get tunnel vision. I would VERY much appreciate someone posting a bullet-proof procedure that is known to work in cloning encrypted HDDs/SDDs to larger storage devices.
This is NOT a duplicate question. The several answers I found on here did not work for me. And all of those answers contained multiple comments posted by others who tried those procedures and failed.
The target dd drive will indeed boot without expanding any partitions.
My primary question is really much more about expanding encrypted file systems than it is about cloning them. Although these two tasks are obviously very closely related. A bullet-proof, scaleable, reliably repeatable procedure that explains how to do both would be extremely helpful. The procedure https://help.ubuntu.com/community/ResizeEncryptedPartitions is a bit too complex for me to follow although I believe I ran the procedure correctly. It's probably very close to what I need but may be missing a step or two.
It seems to me that simply expanding the encrypted partitions on a properly cloned device ought not require more than several commands. Ideally, this is something easily done using GParted.
Many thanks in advance.
16.04 encryption cryptsetup cloning
I'm trying to clone my SDD to a larger device so I will have a bootable backup in anticipation of doing a system upgrade on several desktop clients. I also want to model a known-correct procedure to see if I can reliably clone my system drives to a larger HDD/SDD (so far all attempts to do this in the past have failed). Currently running 16.04 LTS which was built using the fully encrypted disk option. The test system being used is running fine.
I followed several procedures I found on this site but none worked. I hit a dead end with each procedure. So to simplify things, I did the following:
sudo dd if=/dev/sda of=/dev/sdd bs=64k
Opened GParted and deleted the old crypt-luks partition on /dev/sdd as instructed in the procedure posted at Cloning Encrypted SSD to larger SSD. This was a mistake and I was dead in the water from here on. I was unable to create a new crypt-luks partition.
So an answer that explains how to [re]create/resize the crypt-luks partition on the new target drive would be very helpful.
I repeated the dd and tried expanding the target filesystem with the following commands (using LiveCD):
sudo cryptsetup luksOpen /dev/sda5 sda5_crypt
sudo cryptsetup resize sda5_crypt
sudo modprobe dm-crypt
sudo vgscan --mknodes
sudo vgchange -ay
sudo pvresize /dev/mapper/sda5_crypt
sudo lvresize -l +100%FREE /dev/ubuntu-vg/root
returns: New size (7020 extents) matches existing size (7020 extents).
sudo pvchange -x n /dev/mapper/sda5_crypt
returns:
Physical volume "/dev/mapper/sda5_crypt" is already unallocatable.
Physical volume /dev/mapper/sda5_crypt not changed
0 physical volumes changed / 1 physical volume not changed
sudo e2fsck -f /dev/mapper/ubuntu--vg-root
Returns:
Pass 5: Checking group summary information
/dev/mapper/ubuntu--vg-root: 296641/1798720 files (0.8% non-contiguous), 3525828/7188480 blocks
The source SDD was 32Gb and the HDD I am trying to expand is 80 Gb
sudo resize2fs -f /dev/mapper/ubuntu--vg-root
Returns:
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 7188480 (4k) blocks long. Nothing to do!
So it appears that the procedure did not expand the partitions. This is verified by rebooting and running GParted which shows the same partitioning before and after:
I've been at this for many days doing research and trying to get this to work and I'm starting to get tunnel vision. I would VERY much appreciate someone posting a bullet-proof procedure that is known to work in cloning encrypted HDDs/SDDs to larger storage devices.
This is NOT a duplicate question. The several answers I found on here did not work for me. And all of those answers contained multiple comments posted by others who tried those procedures and failed.
The target dd drive will indeed boot without expanding any partitions.
My primary question is really much more about expanding encrypted file systems than it is about cloning them. Although these two tasks are obviously very closely related. A bullet-proof, scaleable, reliably repeatable procedure that explains how to do both would be extremely helpful. The procedure https://help.ubuntu.com/community/ResizeEncryptedPartitions is a bit too complex for me to follow although I believe I ran the procedure correctly. It's probably very close to what I need but may be missing a step or two.
It seems to me that simply expanding the encrypted partitions on a properly cloned device ought not require more than several commands. Ideally, this is something easily done using GParted.
Many thanks in advance.
16.04 encryption cryptsetup cloning
16.04 encryption cryptsetup cloning
edited 6 hours ago
jones0610
asked Jan 18 at 8:42
jones0610jones0610
1,3331321
1,3331321
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28
add a comment |
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28
add a comment |
2 Answers
2
active
oldest
votes
I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.
sudo parted
(parted) print
(parted) resizepart
Partition number? 2
End? [32.0GB]? 100%
(parted) print
(parted) quit
add a comment |
You have forgotten to grow your extended partition. You have to resize /dev/sda2
before you can grow the volumes inside it.
Look at http://yy27.blogspot.com/2009/02/resizing-extended-partitions-with-gnu.html
In his example it is partition 4, in your case it should be 2.
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%2f1110790%2fencrypted-drive-cloning-expanding-partitions-problem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.
sudo parted
(parted) print
(parted) resizepart
Partition number? 2
End? [32.0GB]? 100%
(parted) print
(parted) quit
add a comment |
I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.
sudo parted
(parted) print
(parted) resizepart
Partition number? 2
End? [32.0GB]? 100%
(parted) print
(parted) quit
add a comment |
I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.
sudo parted
(parted) print
(parted) resizepart
Partition number? 2
End? [32.0GB]? 100%
(parted) print
(parted) quit
I'll need to test this on a completely clean set of circumstances but running these commands at the end of the above described procedure seems to work. I will update this solution if I hit any more snags.
sudo parted
(parted) print
(parted) resizepart
Partition number? 2
End? [32.0GB]? 100%
(parted) print
(parted) quit
answered 5 hours ago
jones0610jones0610
1,3331321
1,3331321
add a comment |
add a comment |
You have forgotten to grow your extended partition. You have to resize /dev/sda2
before you can grow the volumes inside it.
Look at http://yy27.blogspot.com/2009/02/resizing-extended-partitions-with-gnu.html
In his example it is partition 4, in your case it should be 2.
add a comment |
You have forgotten to grow your extended partition. You have to resize /dev/sda2
before you can grow the volumes inside it.
Look at http://yy27.blogspot.com/2009/02/resizing-extended-partitions-with-gnu.html
In his example it is partition 4, in your case it should be 2.
add a comment |
You have forgotten to grow your extended partition. You have to resize /dev/sda2
before you can grow the volumes inside it.
Look at http://yy27.blogspot.com/2009/02/resizing-extended-partitions-with-gnu.html
In his example it is partition 4, in your case it should be 2.
You have forgotten to grow your extended partition. You have to resize /dev/sda2
before you can grow the volumes inside it.
Look at http://yy27.blogspot.com/2009/02/resizing-extended-partitions-with-gnu.html
In his example it is partition 4, in your case it should be 2.
answered 7 hours ago
Anders F. U. KiærAnders F. U. Kiær
1,85611025
1,85611025
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%2f1110790%2fencrypted-drive-cloning-expanding-partitions-problem%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
I believe cryptsetup puts its mapped devices under /dev/mapper/ not /dev/, so you might try with /dev/mapper/sdd5_crypt.
– Sebastian
Jan 18 at 21:28