On Thu, May 30, 2013 at 10:21:42PM +0800, Qiu Yu wrote:
> Hi,
>
> Following code snippet, running as non-root user, will throw up a
> 'Permission denied' RuntimeError.
>
> Could someone kindly guide me the correct way to handle LVM disk as
> non-root user?
>
> import guestfsLibguestfs doesn't do anything different from any other program. I'm
> g = guestfs.GuestFS()
> g.add_drive_opts("/dev/vg0/disk1", format="raw")
assuming that /dev/vg0/disk1 isn't accessible by non-root (by anyone)
on your host.
On most Linux distros you can add yourself to the 'disk' group
in order to get access to disk devices:
# usermod -G disk -a yourusername
You may need to log out and log in again after doing that.