diff --git a/publish/rcn-ee_bb.org-stable.sh b/publish/rcn-ee_bb.org-stable.sh
index f3606a2d34fc8fb99366b36103d0a58e7fe1de19..af247416e8a876bc86d8b98b5d80f0678f861c94 100755
--- a/publish/rcn-ee_bb.org-stable.sh
+++ b/publish/rcn-ee_bb.org-stable.sh
@@ -62,6 +62,16 @@ beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs \
 cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
 #!/bin/bash
 
+wait_till_2gb_free () {
+        memory=2048
+        free_memory=\$(free --mega | grep Mem | awk '{print \$7}')
+        until [ "\$free_memory" -gt "\$memory" ] ; do
+                free_memory=$(free --mega | grep Mem | awk '{print \$7}')
+                echo "have [\$free_memory] need [$memory]"
+                sleep 10
+        done
+}
+
 copy_base_rootfs_to_mirror () {
         if [ -d ${mirror_dir}/ ] ; then
                 if [ ! -d ${mirror_dir}/${time}/\${blend}/ ] ; then
@@ -71,6 +81,7 @@ copy_base_rootfs_to_mirror () {
                         if [ ! -f ${mirror_dir}/${time}/\${blend}/\${base_rootfs}.tar.xz ] ; then
                                 cp -v \${base_rootfs}.tar ${mirror_dir}/${time}/\${blend}/
                                 cd ${mirror_dir}/${time}/\${blend}/
+                                wait_till_2gb_free
                                 ${xz_tar} \${base_rootfs}.tar && sha256sum \${base_rootfs}.tar.xz > \${base_rootfs}.tar.xz.sha256sum &
                                 cd -
                         fi
@@ -119,6 +130,7 @@ copy_img_to_mirror () {
                                         sync
                                 fi
                                 cd ${mirror_dir}/${time}/\${blend}/
+                                wait_till_2gb_free
                                 ${xz_img} \${wfile}.img && sha256sum \${wfile}.img.xz > \${wfile}.img.xz.sha256sum &
                                 cd -
                         fi
diff --git a/publish/rcn-ee_elinux.sh b/publish/rcn-ee_elinux.sh
index 34a203cb6a85340b30a88d0fbd527dcb05e23646..ce85c6358cd8ab1a2b532e90857ea187b68d9261 100755
--- a/publish/rcn-ee_elinux.sh
+++ b/publish/rcn-ee_elinux.sh
@@ -35,6 +35,16 @@ am57xx_beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs"
 cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
 #!/bin/bash
 
+wait_till_2gb_free () {
+        memory=2048
+        free_memory=\$(free --mega | grep Mem | awk '{print \$7}')
+        until [ "\$free_memory" -gt "\$memory" ] ; do
+                free_memory=$(free --mega | grep Mem | awk '{print \$7}')
+                echo "have [\$free_memory] need [$memory]"
+                sleep 10
+        done
+}
+
 copy_base_rootfs_to_mirror () {
         if [ -d ${mirror_dir}/ ] ; then
                 if [ ! -d ${mirror_dir}/${time}/\${blend}/ ] ; then
@@ -44,6 +54,7 @@ copy_base_rootfs_to_mirror () {
                         if [ ! -f ${mirror_dir}/${time}/\${blend}/\${base_rootfs}.tar.xz ] ; then
                                 cp -v \${base_rootfs}.tar ${mirror_dir}/${time}/\${blend}/
                                 cd ${mirror_dir}/${time}/\${blend}/
+                                wait_till_2gb_free
                                 ${xz_tar} \${base_rootfs}.tar && sha256sum \${base_rootfs}.tar.xz > \${base_rootfs}.tar.xz.sha256sum &
                                 cd -
                         fi
@@ -92,6 +103,7 @@ copy_img_to_mirror () {
                                         sync
                                 fi
                                 cd ${mirror_dir}/${time}/\${blend}/
+                                wait_till_2gb_free
                                 ${xz_img} \${wfile}.img && sha256sum \${wfile}.img.xz > \${wfile}.img.xz.sha256sum &
                                 cd -
                         fi