Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are the steps I used:

# download a tar file of a root file system
wget https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-root.tar.gz

# create a backing file and a loopback device to it
truncate --size 2GB precise.img
sudo losetup -f precise.img

# find what /dev/loopX was used - it was /dev/loop1 this time
losetup -a

# write out a filesystem and mount it
mkfs /dev/loop1
mkdir mnt
mount /dev/loop1 mnt

# extract the root fs tar into the image file
cd mnt
tar -xvf ../precise-server-cloudimg-amd64-root.tar.gz

cd ../
umount /dev/loop1 

glance image-create --name precise-rootfs --is-public True \
    --disk-format raw --container-format bare \
    --progress --file precise.img

Here are the steps I used:

# download a tar file of a root file system
wget https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-root.tar.gz

# create a backing file and a loopback device to it
truncate --size 2GB precise.img
sudo losetup -f precise.img

# find what /dev/loopX was used - it was /dev/loop1 this time
losetup -a

# write out a filesystem and mount it
sudo mkfs /dev/loop1
mkdir mnt
sudo mount /dev/loop1 mnt

# extract the root fs tar into the image file
cd mnt
tar -xvf ../precise-server-cloudimg-amd64-root.tar.gz

cd ../
sudo umount /dev/loop1 

glance image-create --name precise-rootfs --is-public True \
    --disk-format raw --container-format bare \
    --progress --file precise.img