KVM can't access qcow2 images storend on an external HDD
I'm running Deepin 15.3 x64 and i have an external HDD with EXT4 file system. whereat i store things like VM images. Oracle VM VirtualBox and VMware Workstation Player works just fine with this config, but KVM can't read files from it. I've tried to chown the files, the container directory and even chmod -R 0777 on the entire drive. But KVM still complains that it can't access the directory. However KVM can create images there, but KVM won't be able to access the image file as soon as it gets created. Here's a video of this (in case something's not clear). Note that I can't move the images to /var/lib/libvirt/images because i don't have enough space on my SSD for any of them.
kvm qemu external-hdd disk-image
add a comment |
I'm running Deepin 15.3 x64 and i have an external HDD with EXT4 file system. whereat i store things like VM images. Oracle VM VirtualBox and VMware Workstation Player works just fine with this config, but KVM can't read files from it. I've tried to chown the files, the container directory and even chmod -R 0777 on the entire drive. But KVM still complains that it can't access the directory. However KVM can create images there, but KVM won't be able to access the image file as soon as it gets created. Here's a video of this (in case something's not clear). Note that I can't move the images to /var/lib/libvirt/images because i don't have enough space on my SSD for any of them.
kvm qemu external-hdd disk-image
add a comment |
I'm running Deepin 15.3 x64 and i have an external HDD with EXT4 file system. whereat i store things like VM images. Oracle VM VirtualBox and VMware Workstation Player works just fine with this config, but KVM can't read files from it. I've tried to chown the files, the container directory and even chmod -R 0777 on the entire drive. But KVM still complains that it can't access the directory. However KVM can create images there, but KVM won't be able to access the image file as soon as it gets created. Here's a video of this (in case something's not clear). Note that I can't move the images to /var/lib/libvirt/images because i don't have enough space on my SSD for any of them.
kvm qemu external-hdd disk-image
I'm running Deepin 15.3 x64 and i have an external HDD with EXT4 file system. whereat i store things like VM images. Oracle VM VirtualBox and VMware Workstation Player works just fine with this config, but KVM can't read files from it. I've tried to chown the files, the container directory and even chmod -R 0777 on the entire drive. But KVM still complains that it can't access the directory. However KVM can create images there, but KVM won't be able to access the image file as soon as it gets created. Here's a video of this (in case something's not clear). Note that I can't move the images to /var/lib/libvirt/images because i don't have enough space on my SSD for any of them.
kvm qemu external-hdd disk-image
kvm qemu external-hdd disk-image
asked Feb 9 '17 at 18:40
Weylyn SavanWeylyn Savan
108113
108113
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
add a comment |
Solution:
Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
add a comment |
KVM uses libvirt, which requires images to be in a defined pool. You can do this with Virsh by copying the config of the default pool
virsh pool-dumpxml default > new_pool.xml
edit new_pool.xml ## use a different name & path
virsh pool-create new_pool.xml
virsh pool-refresh name
KVM should then be able to pick up images on your additional drive.
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself
– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
add a comment |
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f343814%2fkvm-cant-access-qcow2-images-storend-on-an-external-hdd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
add a comment |
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
add a comment |
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
edited Feb 13 '18 at 16:28
Jesse_b
12.4k23066
12.4k23066
answered Feb 13 '18 at 16:01
GordsterGordster
261
261
add a comment |
add a comment |
Solution:
Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
add a comment |
Solution:
Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
add a comment |
Solution:
Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
Solution:
Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
edited Mar 17 '18 at 23:38
Rui F Ribeiro
39.7k1479132
39.7k1479132
answered Feb 26 '17 at 7:51
Weylyn SavanWeylyn Savan
108113
108113
add a comment |
add a comment |
KVM uses libvirt, which requires images to be in a defined pool. You can do this with Virsh by copying the config of the default pool
virsh pool-dumpxml default > new_pool.xml
edit new_pool.xml ## use a different name & path
virsh pool-create new_pool.xml
virsh pool-refresh name
KVM should then be able to pick up images on your additional drive.
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself
– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
add a comment |
KVM uses libvirt, which requires images to be in a defined pool. You can do this with Virsh by copying the config of the default pool
virsh pool-dumpxml default > new_pool.xml
edit new_pool.xml ## use a different name & path
virsh pool-create new_pool.xml
virsh pool-refresh name
KVM should then be able to pick up images on your additional drive.
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself
– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
add a comment |
KVM uses libvirt, which requires images to be in a defined pool. You can do this with Virsh by copying the config of the default pool
virsh pool-dumpxml default > new_pool.xml
edit new_pool.xml ## use a different name & path
virsh pool-create new_pool.xml
virsh pool-refresh name
KVM should then be able to pick up images on your additional drive.
KVM uses libvirt, which requires images to be in a defined pool. You can do this with Virsh by copying the config of the default pool
virsh pool-dumpxml default > new_pool.xml
edit new_pool.xml ## use a different name & path
virsh pool-create new_pool.xml
virsh pool-refresh name
KVM should then be able to pick up images on your additional drive.
answered Feb 10 '17 at 15:07
RobotJohnnyRobotJohnny
788416
788416
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself
– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
add a comment |
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself
– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
virsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
– Weylyn Savan
Feb 10 '17 at 20:27
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
Ok, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
– Weylyn Savan
Feb 12 '17 at 21:20
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:
ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself– RobotJohnny
Feb 13 '17 at 15:37
The above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:
ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself– RobotJohnny
Feb 13 '17 at 15:37
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
It's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
– Weylyn Savan
Feb 14 '17 at 6:15
add a comment |
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
New contributor
add a comment |
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
New contributor
add a comment |
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
New contributor
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
New contributor
New contributor
answered 12 mins ago
HouchengHoucheng
1011
1011
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f343814%2fkvm-cant-access-qcow2-images-storend-on-an-external-hdd%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