delta1512 / BOINCOS

Scripts and files used by BOINC-OS
GNU General Public License v3.0
17 stars 1 forks source link

Lowering size of image #7

Open delta1512 opened 6 years ago

delta1512 commented 6 years ago

Writing the full size of a disk to a USB is far too wasteful and I am keen on finding a method of getting it to a size that is related to the actual content of the image rather than its entire recollection (including empty space.

A method of generating a sparse, bootable image from a USB is required. Feel free to post any ideas.

tcblack commented 6 years ago

Does this help? https://serverfault.com/questions/714872/truncate-empy-space-from-a-raw-dd-image

delta1512 commented 6 years ago

I'll try it out, I remember looking into what's called a "sparse file" beforehand but what I worry about is that the disk will not maintain its original partitions and other important information. An installer would solve this problem but that's not exactly the aim of BOINC OS.

To describe the build process, I wipe the USB with all zeros, then install the system, then I use gnome disk utility as opposed to dd for generating the image. If we could get rid of those zeroes but maintain the rest of the FS and partitions It would be perfect.

tcblack commented 6 years ago

I actually remember reading about how to do that somewhere in ... either Debian or LFS. I'll try to look next week and see if I can find it. Come to think of it, it might have been Gentoo. It was one of the source heavy distros.

delta1512 commented 6 years ago

@tcblack I managed to lower the size of the zipped image but not the image itself. I think I know what we are looking for now so I'll edit the issue to better reflect my findings.

I figured that by using zerofree on the partition before cloning it helped save over 400MB on the zip file. But no matter what I tried in regards to sparse imaging didn't work, I tried the conv=sparse flag on dd and did the following: dd if=/dev/usb | cp --sparse=always /dev/stdin test.img with no luck on making a truly sparse image.

Thankyou for the help!

tcblack commented 6 years ago

Found some info on squashfs that I was wondering if it would be helpful.
http://linuxfromscratch.org/hints/downloads/files/squashfs.txt

delta1512 commented 6 years ago

I believe that squashfs is read-only, I thought about it before but soon discovered this. It would make a great option for the TMPOS experimental spin though, I'll make a new thread for TMPOS ideas.

Edit: Just learnt about a workaround that allows writeability which I might look into in the future