Re: [lorax] how to decrease squashfs.img size, it increase more than install size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# unsquashfs -d /tmp/1 /var/tmp/tmp3vk1TM/LiveOS/squashfs.img
# unsquashfs -d /tmp/2 /var/tmp/tmpWRiKra/LiveOS/squashfs.img

# find /tmp -name '*.img'|xargs du -sh
1.1G    /tmp/1/LiveOS/rootfs.img
1.1G    /tmp/2/LiveOS/rootfs.img

# ll /tmp/{1..2}/LiveOS/rootfs.img
-rw-r--r-- 1 root root 21G | 2014-07-22 18:23:55 | /tmp/1/LiveOS/rootfs.img
-rw-r--r-- 1 root root 21G | 2014-07-22 18:23:50 | /tmp/2/LiveOS/rootfs.img

# mount -o loop /tmp/1/LiveOS/rootfs.img /media/1
# mount -o loop /tmp/2/LiveOS/rootfs.img /media/2

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop3       21G  619M   21G   3% /media/2
/dev/loop4       21G  806M   20G   4% /media/1




2014-07-22 18:16 GMT+08:00 耳东 <volcanowill@xxxxxxxxx>:
@Vratislav Podzimek

I have made a mistake. After clean locale files, squashfs.img became larger than before.

# losetup -l
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0         0      0         1  0 /var/tmp/tmp3vk1TM/LiveOS/squashfs.img
/dev/loop1         0      0         1  1 /mnt/1/LiveOS/rootfs.img
/dev/loop2         0      0         1  0 /var/tmp/tmpWRiKra/LiveOS/squashfs.img
/dev/loop3         0      0         1  1 /mnt/2/LiveOS/rootfs.img

/dev/loop0      312M  312M     0 100% /mnt/1        <-- before clean

/dev/loop1       21G  806M   20G   4% /media/1      <-- before clean
/dev/loop2      315M  315M     0 100% /mnt/2        <-- after clean

/dev/loop3       21G  619M   21G   3% /media/2      <-- after clean

# du -sh /var/tmp/tmp3vk1TM/LiveOS/squashfs.img
312M    /var/tmp/tmp3vk1TM/LiveOS/squashfs.img

# du -sh /var/tmp/tmpWRiKra/LiveOS/squashfs.img
315M    /var/tmp/tmpWRiKra/LiveOS/squashfs.img


After I unsquashfs these two squashfs.img, their sizes were same.

# unsquashfs -d /tmp/2 /var/tmp/tmpWRiKra/LiveOS/squashfs.img
# unsquashfs -d /tmp/1 /var/tmp/tmpWRiKra/LiveOS/squashfs.img

# find /tmp -name '*.img'|xargs du -sh
1.1G    /tmp/1/LiveOS/rootfs.img
1.1G    /tmp/2/LiveOS/rootfs.img

# ll /tmp/{1..2}/LiveOS/rootfs.img
-rw-r--r-- 1 root root 21G | 2014-07-21 18:00:19 | /tmp/1/LiveOS/rootfs.img
-rw-r--r-- 1 root root 21G | 2014-07-21 20:35:24 | /tmp/2/LiveOS/rootfs.img




2014-07-22 16:38 GMT+08:00 Vratislav Podzimek <vpodzime@xxxxxxxxxx>:

On Tue, 2014-07-22 at 09:36 +0800, 耳东 wrote:
> hi guys, I have refered to the minimal ks config of
> cloud-kickstarts.git:
>
>
> https://git.fedorahosted.org/cgit/cloud-kickstarts.git/tree/container/container-small-20.ks
>
> I have clean unused locales and some file.
>
> - compress cracklib pw_dict
> - clean unused locale files
> - rm some static pictures and log files
>
> the different ks config:
>
>     +gzip -9 /usr/share/cracklib/pw_dict.pwd
>     +localedef --list-archive | grep -v en_US | xargs localedef
> --delete-from-archive
>     +mv
> -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl
>     +/usr/sbin/build-locale-archive
>     +mv -f /usr/share/locale/en /usr/share/locale/en_US /tmp
>     +rm -rf /usr/share/locale/*
>     +mv /tmp/en /tmp/en_US /usr/share/locale/
>     +mv /usr/share/i18n/locales/en_US /tmp
>     +rm -rf /usr/share/i18n/locales/*
>     +mv /tmp/en_US /usr/share/i18n/locales/
>     +echo '%_install_langs C:en:en_US:en_US.UTF-8'
> >> /etc/rpm/macros.imgcreate
>     +
>     +truncate -c -s 0 /var/log/lastlog
>
>      rpm -qa|sort > /root/rpm-qa.txt
>      yum clean all
>      rm -f /etc/resolv.conf
>      rm -f /var/lib/rpm/__db*
>     +rm -rf /tmp/*
>     +rm -fr /var/log/anaconda
>      rm -fr /usr/share/doc/*
>     +rm -fr /usr/share/backgrounds/*
>     +rm -fr /usr/share/kde4/*
>     +rm -fr /var/lib/yum/yumdb/*
>
> I mount the different squashfs.img file:
>
>     /dev/loop0      312M  312M     0 100% /mnt/1
>     /dev/loop1       21G  806M   20G   4% /media/1          <-- before
> clean
>
>     /dev/loop2      315M  315M     0 100% /mnt/2
>     /dev/loop3       21G  619M   21G   3% /media/2          <-- after
> clean
>
> the install size was saved 806M - 619M = 187M, but squashfs.img only
> save 315M - 312M = 3M
> where has the spare space gone ?
I think this is a question for people around squashfs, but as you can
see the content is highly compressed so if you removed 187 M of data
with high compression ratio (which locales definitely are), the
difference may be such small.

But the original issue with 100 MB bump is really wierd. Did you try
running unsquashfs followed by mksquashfs to see if it stays the same?

--
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux