Difference between revisions of "Talk:LiveOS image"

From Sugar Labs
Jump to navigation Jump to search
(Replaced content with "Previous content for this page is now at the Fedora Project wiki, fedora:Talk:LiveOS image. --~~~~")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
It turns out that it is possible to merge down the persistent overlay into the base image, if you have access to another OS installation and sufficient disk space.
+
Previous content for this page is now at the Fedora Project wiki, [[fedora:Talk:LiveOS image]]. --[[User:FGrose|FGrose]] 22:15, 21 August 2012 (EDT)
I like that result better than just having to increase the overlay size without bounds.
 
 
 
Tested and working on Fedora 17, all commands as root. You will need disk space sufficient for the uncompressed size of the root filesystem, 4 GB in the case of Fedora 17 LiveCD/USB. I assume only one image and one user on the machine.
 
 
 
Step 1: Get access to read-write base image, note that I got loop2 and loop3 here, YMMV.
 
<nowiki>mkdir squashfs
 
mount -o loop /run/media/*/LIVE/LiveOS/squashfs.img squashfs/
 
cp squashfs/LiveOS/ext3fs.img .</nowiki>
 
 
 
Step 2: Set up loopback and device mapper devices for persistent overlay, base device mapper and snapshot.
 
<nowiki>losetup -f ext3fs.img
 
losetup -f /run/media/*/LIVE/LiveOS/overlay-*
 
echo 0 $(blockdev --getsize /dev/loop2) linear /dev/loop2 0 |dmsetup create orig
 
echo 0 $(blockdev --getsize /dev/mapper/orig) snapshot /dev/mapper/orig /dev/loop3 p 8 | dmsetup create top</nowiki>
 
 
 
Step 3: Stop the snapshot device and merge the snapshot with the base
 
<nowiki>dmsetup suspend top
 
echo 0 $(blockdev --getsize /dev/loop2) snapshot-merge /dev/loop2 /dev/loop3 p 8 | dmsetup create mergeomatic && dmsetup status mergeomatic</nowiki>
 
 
 
Step 4: Wait for merge to complete. When the status report on mergeomatic reports allocated blocks equal to the metadata blocks, the merge is finished.
 
dmsetup status
 
 
 
Step 5: Remove the merge target.
 
dmsetup remove mergeomatic
 
 
 
Step 6: Set the top device to no snapshot, and inspect the filesystem for results, if desired.
 
<nowiki>echo 0 $(blockdev --getsize /dev/loop2) linear /dev/loop2 0 | dmsetup load top
 
dmsetup resume top
 
mkdir root
 
mount /dev/mapper/top root
 
cd root
 
chroot .</nowiki>
 
 
 
Step 7: Clean up.
 
<nowiki>cd ..
 
umount root
 
dmsetup remove top
 
dmsetup remove orig
 
losetup -d /dev/loop2
 
losetup -d /dev/loop3
 
umount squashfs/</nowiki>
 
 
 
Step 8: Copy the root filesystem image back into the squashfs image, you may need -noappend
 
<nowiki>mkdir LiveOS
 
mv ext3fs.img LiveOS
 
rm /run/media/*/LIVE/LiveOS/squashfs.img
 
mksquashfs LiveOS /run/media/*/LIVE/LiveOS/squashfs.img -keep-as-directory</nowiki>
 
 
 
Sources: <br>
 
*http://smorgasbord.gavagai.nl/2010/03/online-merging-of-cow-volumes-with-dm-snapshot <br>
 
*http://www.kernel.org/doc/Documentation/device-mapper/snapshot.txt<br>
 
*http://linuxgazette.net/114/kapil.html<br>
 
 
 
--[[User:Andrew Gilmore|Andrew Gilmore]]
 

Latest revision as of 21:15, 21 August 2012

Previous content for this page is now at the Fedora Project wiki, fedora:Talk:LiveOS image. --FGrose 22:15, 21 August 2012 (EDT)