Failing to encrypt volume due to it being mapped or mounted
I have an Ubuntu 18.04 server VM that I need to encrypt some volumes on. This server has 8 disks attached to it. I'm a Linux newbie so I'm just trying to go with the most straight forward solution for now which seems to be Cryptsetup
with LUKS
.
I created a keyfile containing a passphrase:
echo -n 'your_passphrase' > /path/to/<keyfile>
chown root:root /path/to/<keyfile>; chmod 400 /path/to/<keyfile>
ran sudo fdisk -l
to verify the disks attached so I could find the one I need to encrypt.
I then ran the following command, which if I understanding the docs correctly should encrypt the drive using my keyfile.
sudo cryptsetup luksFormat --type luks2 /dev/sde /tmp/keyfile
I'm getting an error when I try to run this though stating that
Cannot use device /dev/sde which is in use (already mapped or mounted).
This confuses me a bit as I'm not aware of how you would encrypt a drive from a machine if it's not attached to it. Perhaps I'm mixed up in that you can have a drive attached to a VM but not mounted? If that's the case do I need to unmount the drive, run my encryption command and then remount it and use the key to make sure it can be accessed? I appreciate any guidance given, Thanks!
encryption luks
New contributor
add a comment |
I have an Ubuntu 18.04 server VM that I need to encrypt some volumes on. This server has 8 disks attached to it. I'm a Linux newbie so I'm just trying to go with the most straight forward solution for now which seems to be Cryptsetup
with LUKS
.
I created a keyfile containing a passphrase:
echo -n 'your_passphrase' > /path/to/<keyfile>
chown root:root /path/to/<keyfile>; chmod 400 /path/to/<keyfile>
ran sudo fdisk -l
to verify the disks attached so I could find the one I need to encrypt.
I then ran the following command, which if I understanding the docs correctly should encrypt the drive using my keyfile.
sudo cryptsetup luksFormat --type luks2 /dev/sde /tmp/keyfile
I'm getting an error when I try to run this though stating that
Cannot use device /dev/sde which is in use (already mapped or mounted).
This confuses me a bit as I'm not aware of how you would encrypt a drive from a machine if it's not attached to it. Perhaps I'm mixed up in that you can have a drive attached to a VM but not mounted? If that's the case do I need to unmount the drive, run my encryption command and then remount it and use the key to make sure it can be accessed? I appreciate any guidance given, Thanks!
encryption luks
New contributor
add a comment |
I have an Ubuntu 18.04 server VM that I need to encrypt some volumes on. This server has 8 disks attached to it. I'm a Linux newbie so I'm just trying to go with the most straight forward solution for now which seems to be Cryptsetup
with LUKS
.
I created a keyfile containing a passphrase:
echo -n 'your_passphrase' > /path/to/<keyfile>
chown root:root /path/to/<keyfile>; chmod 400 /path/to/<keyfile>
ran sudo fdisk -l
to verify the disks attached so I could find the one I need to encrypt.
I then ran the following command, which if I understanding the docs correctly should encrypt the drive using my keyfile.
sudo cryptsetup luksFormat --type luks2 /dev/sde /tmp/keyfile
I'm getting an error when I try to run this though stating that
Cannot use device /dev/sde which is in use (already mapped or mounted).
This confuses me a bit as I'm not aware of how you would encrypt a drive from a machine if it's not attached to it. Perhaps I'm mixed up in that you can have a drive attached to a VM but not mounted? If that's the case do I need to unmount the drive, run my encryption command and then remount it and use the key to make sure it can be accessed? I appreciate any guidance given, Thanks!
encryption luks
New contributor
I have an Ubuntu 18.04 server VM that I need to encrypt some volumes on. This server has 8 disks attached to it. I'm a Linux newbie so I'm just trying to go with the most straight forward solution for now which seems to be Cryptsetup
with LUKS
.
I created a keyfile containing a passphrase:
echo -n 'your_passphrase' > /path/to/<keyfile>
chown root:root /path/to/<keyfile>; chmod 400 /path/to/<keyfile>
ran sudo fdisk -l
to verify the disks attached so I could find the one I need to encrypt.
I then ran the following command, which if I understanding the docs correctly should encrypt the drive using my keyfile.
sudo cryptsetup luksFormat --type luks2 /dev/sde /tmp/keyfile
I'm getting an error when I try to run this though stating that
Cannot use device /dev/sde which is in use (already mapped or mounted).
This confuses me a bit as I'm not aware of how you would encrypt a drive from a machine if it's not attached to it. Perhaps I'm mixed up in that you can have a drive attached to a VM but not mounted? If that's the case do I need to unmount the drive, run my encryption command and then remount it and use the key to make sure it can be accessed? I appreciate any guidance given, Thanks!
encryption luks
encryption luks
New contributor
New contributor
New contributor
asked 10 hours ago
Stavros_SStavros_S
1011
1011
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
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
});
}
});
Stavros_S is a new contributor. Be nice, and check out our Code of Conduct.
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%2f1122016%2ffailing-to-encrypt-volume-due-to-it-being-mapped-or-mounted%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Stavros_S is a new contributor. Be nice, and check out our Code of Conduct.
Stavros_S is a new contributor. Be nice, and check out our Code of Conduct.
Stavros_S is a new contributor. Be nice, and check out our Code of Conduct.
Stavros_S is a new contributor. Be nice, and check out our Code of Conduct.
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%2f1122016%2ffailing-to-encrypt-volume-due-to-it-being-mapped-or-mounted%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