LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 09-17-2010, 05:54 PM   #1
frozenQueue
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Rep: Reputation: 0
Constructing disk images without root privileges?


Hi. I have some projects going in which I compile minimalistic Linux system components, copy them into disk image (.img) files, and then run the assembled system in qemu.

System assembly has been kind of like so:
1. Use dd to create empty image file
2. Use losetup to map image file to loop device
3. partition loop device with fdisk
4. use kpartx to map all partitions in loop device to /dev/mapper
5. copy in appropriate files to appropriate partitions
6. install grub or lilo on image through original loop device

The lame part of this whole setup, however, is that it requires root privileges. It is inconvenient to be working as root, and it is especially scary when running commands like fdisk.

On the Internet I found a program called mountlo which supposedly can create loop devices from disk images without root privileges. (Through fuse). However, I have yet to find a userspace version of kpartx.

Anyone have any ideas that could help me out here?
 
Old 09-18-2010, 03:39 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If you want to separate privileges then it would be safest to only let root read files your can then pull into your setup. Creating a sparse (growable qcow?) disk image, create a Qemu guest that loads a custom Live CD or rescue initrd with networking, attach the sparse image (maybe even populate a small filesystem and bootloader) then suspend the guest. This creates a template you can copy for use, bring on-line in seconds. What interface you use to issue commands and copy files over depends on what your guest loads: netcat, ssh, everything is possible and his way any destructive commands need only be run inside the Qemu guest.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logged in as ROOT: Don't have necessary privileges! snowweb Linux - Newbie 1 09-08-2009 04:01 PM
Ssh root privileges gabsik Linux - Security 1 05-28-2008 10:19 PM
mkdir with root privileges slam Programming 3 09-29-2006 05:22 PM
USB HD Needs Root Privileges rrrssssss Linux - Hardware 3 11-13-2005 04:08 PM
Xine and root privileges markus1982 Linux - Software 1 08-18-2003 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 05:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration