Just a quick write up here on how to make a portable image you can mount in LXC which you can move around.
Download minimal ubuntu
Let’s start by downloading a minimal ubuntu raring for this we need sudo:
This will install ubuntu raring into the directory
sudo debootstrap --variant minbase raring raring;
We can now
chroot into this directory in order to minimize a little and clean the apt-get packages
that got installed during the
You can now install your own software, packages and such. When you are done and ready to package your stuff up you can do:
To clean and exit your
Create a file volume
Next up is creating the file volume which we will mount. And copy the filesystem too so we can move it around as a single file.
Let’s check the size of our
raring directory first.
du -hs raring
Remember that amount and lets create an empty file zero padded. The
if means file in, the
of means file out. The
bs the size
of block. The
count means the number of blocks. Replace the count in the sample below with your own count of megabytes, and allocate
a bit extra since
mkfs will steal space some in regards to administraton of blocks.
# size of the Raring directory + some extra dd of=ubuntu-raring.img if=/dev/zero bs=1M count=200
It will take a while to populate. When done time to
mkfs the image.
After this we can mount the image.
mkdir /dev/ubuntu-raring mount ubuntu-raring.img /dev/ubuntu-raring
And now we can finally copy our raring directory to our
cd raring rsync -a . /dev/ubuntu-raring
You can now mount this image in LXC with or without AUFS.
If you want to move it around you can use
tar to compress your image.
Hey you 👋 Want FREE resources to become the best developer and get a competitive edge? Subscribe!
Would you like to stay up to date on ? Subscribe here! I'll only use your email to keep u up to date on new technology and software development tips. It wont be shared. Feel free to unsubscribe anytime!