diff mbox series

image: use du --apparent-size when calculating rootfs size

Message ID 20180111151834.4169-1-ross.burton@intel.com
State New
Headers show
Series image: use du --apparent-size when calculating rootfs size | expand

Commit Message

Ross Burton Jan. 11, 2018, 3:18 p.m. UTC
We should pass --apparent-size to du when calculating how large the rootfs is as
otherwise we get the actual disk usage, which if the files are compressed by the
file system (such as ZFS) may be sufficiently smaller than the space required by
the image that construction will fail.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/image.bbclass | 1 +
 1 file changed, 1 insertion(+)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Alexander Kanavin Jan. 11, 2018, 3:29 p.m. UTC | #1
On 01/11/2018 05:18 PM, Ross Burton wrote:
> We should pass --apparent-size to du when calculating how large the rootfs is as

> otherwise we get the actual disk usage, which if the files are compressed by the

> file system (such as ZFS) may be sufficiently smaller than the space required by

> the image that construction will fail.

> 

> Signed-off-by: Ross Burton <ross.burton@intel.com>

> ---

>   meta/classes/image.bbclass | 1 +

>   1 file changed, 1 insertion(+)

> 

> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass

> index 4531aa2a57a..8e763e4d543 100644

> --- a/meta/classes/image.bbclass

> +++ b/meta/classes/image.bbclass

> @@ -534,6 +534,7 @@ def get_rootfs_size(d):

>       initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')

>   

>       output = subprocess.check_output(['du', '-ks',

> +                                      '--apparent-size',

>                                         d.getVar('IMAGE_ROOTFS')])

>       size_kb = int(output.split()[0])


Exactly same patch from Maxin caused failures previously, no?

Alex
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Jan. 11, 2018, 3:42 p.m. UTC | #2
On 11 January 2018 at 15:29, Alexander Kanavin <
alexander.kanavin@linux.intel.com> wrote:

> On 01/11/2018 05:18 PM, Ross Burton wrote:

>

>> We should pass --apparent-size to du when calculating how large the

>> rootfs is as

>> otherwise we get the actual disk usage, which if the files are compressed

>> by the

>> file system (such as ZFS) may be sufficiently smaller than the space

>> required by

>> the image that construction will fail.

>>

>> Signed-off-by: Ross Burton <ross.burton@intel.com>

>> ---

>>   meta/classes/image.bbclass | 1 +

>>   1 file changed, 1 insertion(+)

>>

>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass

>> index 4531aa2a57a..8e763e4d543 100644

>> --- a/meta/classes/image.bbclass

>> +++ b/meta/classes/image.bbclass

>> @@ -534,6 +534,7 @@ def get_rootfs_size(d):

>>       initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')

>>         output = subprocess.check_output(['du', '-ks',

>> +                                      '--apparent-size',

>>                                         d.getVar('IMAGE_ROOTFS')])

>>       size_kb = int(output.split()[0])

>>

>

> Exactly same patch from Maxin caused failures previously, no?

>


Hm, I knew I remembered seeing this before, and found my patches from 2015,
but didn't see the ones from Maxin.  I'll dig the archives again.

Ross
<div dir="ltr">On 11 January 2018 at 15:29, Alexander Kanavin <span dir="ltr">&lt;<a href="mailto:alexander.kanavin@linux.intel.com" target="_blank">alexander.kanavin@linux.intel.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 01/11/2018 05:18 PM, Ross Burton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
We should pass --apparent-size to du when calculating how large the rootfs is as<br>
otherwise we get the actual disk usage, which if the files are compressed by the<br>
file system (such as ZFS) may be sufficiently smaller than the space required by<br>
the image that construction will fail.<br>
<br>
Signed-off-by: Ross Burton &lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;<br>

---<br>
  meta/classes/image.bbclass | 1 +<br>
  1 file changed, 1 insertion(+)<br>
<br>
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass<br>
index 4531aa2a57a..8e763e4d543 100644<br>
--- a/meta/classes/image.bbclass<br>
+++ b/meta/classes/image.bbclass<br>
@@ -534,6 +534,7 @@ def get_rootfs_size(d):<br>
      initramfs_maxsize = d.getVar(&#39;INITRAMFS_MAXSIZE&#39;)<br>
        output = subprocess.check_output([&#39;du&#39;, &#39;-ks&#39;,<br>
+                                      &#39;--apparent-size&#39;,<br>
                                        d.getVar(&#39;IMAGE_ROOTFS&#39;)])<br>
      size_kb = int(output.split()[0])<br>
</blockquote>
<br></span>
Exactly same patch from Maxin caused failures previously, no?<br></blockquote><div><br></div><div>Hm, I knew I remembered seeing this before, and found my patches from 2015, but didn&#39;t see the ones from Maxin.  I&#39;ll dig the archives again.</div><div><br></div><div>Ross </div></div></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Jan. 11, 2018, 3:43 p.m. UTC | #3
On 11 January 2018 at 15:42, Burton, Ross <ross.burton@intel.com> wrote:

> Exactly same patch from Maxin caused failures previously, no?

>>

>

> Hm, I knew I remembered seeing this before, and found my patches from

> 2015, but didn't see the ones from Maxin.  I'll dig the archives again

>


Found it, bad search.  Lets see what happens on the AB this time...

Ross
<div dir="ltr">On 11 January 2018 at 15:42, Burton, Ross <span dir="ltr">&lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Exactly same patch from Maxin caused failures previously, no?<br></blockquote><div><br></div></span><div>Hm, I knew I remembered seeing this before, and found my patches from 2015, but didn&#39;t see the ones from Maxin.  I&#39;ll dig the archives again</div></div></div></div></blockquote><div><br></div><div>Found it, bad search.  Lets see what happens on the AB this time...</div><div><br></div><div>Ross </div></div></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Alexander Kanavin Jan. 11, 2018, 3:45 p.m. UTC | #4
On 01/11/2018 05:42 PM, Burton, Ross wrote:

>     Exactly same patch from Maxin caused failures previously, no?
> 
> 
> Hm, I knew I remembered seeing this before, and found my patches from 
> 2015, but didn't see the ones from Maxin.  I'll dig the archives again.

http://lists.openembedded.org/pipermail/openembedded-core/2017-November/144748.html

You're welcome :)

Alex
diff mbox series

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4531aa2a57a..8e763e4d543 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -534,6 +534,7 @@  def get_rootfs_size(d):
     initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
 
     output = subprocess.check_output(['du', '-ks',
+                                      '--apparent-size',
                                       d.getVar('IMAGE_ROOTFS')])
     size_kb = int(output.split()[0])