3 Replies Latest reply on Jan 31, 2017 2:06 PM by Intel Corporation

    Building partitions

    Peter-H

      Hello

      While building a new image I want to make the partitions smaller so I modified poky/meta-intel-edison/meta-intel-edison-bsp/recipes-bsp/u-boot/files/edison.env. I reduced the size of root and specified the size of home.

      partitions=uuid_disk=${uuid_disk};name=u-boot0,start=1MiB,size=2MiB,uuid=${uuid_uboot0};name=u-boot-env0,size=1MiB,uuid=${uuid_uboot_env0};name=u-boot1,size=2MiB,uuid=${uuid_uboot1};name=u-boot-env1,size=1MiB,uuid=${uuid_uboot_env1};name=factory,size=1MiB,uuid=${uuid_factory};name=panic,size=24MiB,uuid=${uuid_panic};name=boot,size=32MiB,uuid=${uuid_boot};name=rootfs,size=512MiB,uuid=${uuid_rootfs};name=update,size=512MiB,uuid=${uuid_update};name=home,size=128MiB,uuid=${uuid_home};

      According to some sources I should also modify IMAGE_ROOTFS_SIZE found in  poky/meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-image.bb

      I noted that IMAGE_ROOTFS_SIZE was already 512MB(524288) by default so I didn't change that value..

       

      With this build I ended up with /home being 1.3GB.

      I check fw_printenv on the running system and the size for home is still specified as 128MiB.

      I haven't specified or changed any equivalent to IMAGE_ROOTFS_SIZE.

       

      How can I make the /home partition a specific size?

       

      My end goal is an update mechanism with two sets of partitions. The first set would be built as usual in the image into a working system. This system would slowly populate the second set of partitions. When finished a quick switch would be done by a fw_setenv followed by a reboot.

      In terms of space the 4GB is more than enough for my needs, I could probably fit 8 pairs of systems if needed.

      My understanding of the "reboot ota" is that it unzip and overwrite the system in one go.

      My hope is that my approach would be safer since there won't be a time the system can break if power is lost and the downtime would be minimal. Does this sound right?

       

      I would need to create more partitions. These partitions doesn't need to be formatted as they would be overwritten by upgrade images.

      Can I create more partitions by simply appending "partitions=" in edison.env?

      I tried changing the partitions using fw_setenv on a running system. After a reboot I couldn't see any extra partitions.

       

      How are the current partitions UUID used? Does the build system rely on the root partition to have a specific UUID or can I assign them specific values in edison.env?

      The latter would be preferable, to have the same UUID of a partition over several builds.

        • 1. Re: Building partitions
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Peter-H,

          Thanks for reaching out.

          I have found some links, maybe they can be helpful for you:

          https://communities.intel.com/thread/58749
          http://alextgalileo.altervista.org/blog/changing-partition-setup-edison/

          I will continue investigating about this and I'll contact you when I have updates.

          Have a nice day.

          Regards,
          -Leonardo

          • 2. Re: Building partitions
            Peter-H

            Upon further experimentation these are my quite successful results.

             

            Adding partitions

            • partitions
              • Add any extra partions you want
              • Their UUID can be arbitrary, I chose to write them into other variables thus using the same short form for my new partitions as the existing ones, this also helps further down when I will switch root partitions.
              • If you make a copy of u-boot0 make sure to remove the "start=" since it will overlap the first one and prevent the partitioning from happening.
            • I assume the content of /home is not generated at build time so /home must be formatted sometime during first boot.

            Adding partitions on an existing system

            • use the fw_printenv/fw_setenv commands to update the parameters
              • partitions as described above
              • fw_setenv do_partition_done 0
                • This will trigger a regeneration of disk partitions which I didn't do in the first post.
              • reboot

            Switching root partitions

            • Prepare the new root
              • format the new extra root partition, I called it rootfs_b
              • mount the new partition on /mnt/rootfs_b
              • copy the files from current root to the new one
                • cp -ax / /mnt/rootfs_b
            • Set the new root as active
              • fw_setenv do_bootargs_rootfs setenv bootargs_rootfs rootwait root=PARTUUID=${uuid_rootfs_b} rootfstype=ext4
              • Note that uuid_rootfs_b is a variable I created which has the UUID of the new root partition I added under "Adding partitions"
            • Do some modification to /mnt/rootfs_b so that you can verify you actually are running on the new partition
              • touch /mnt/rootfs_b/this_is_rootfs_b
            • reboot

             

            What didn't work

            • dd if=/dev/disk/by-partlabel/rootfs of=/dev/disk/by-partlabel/rootfs_b
              • Although I did this with rootfs being live I would have expected it to not crash as critical as it did. Not a single file was recoverable from the rootfs_b partition

            What I haven't tried

            • Switching other partitions than rootfs
            • Understanding why /home got larger, a guess would be that the last partition in the table get the rest of the disk regardless of the specified size.
            • 3. Re: Building partitions
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi Peter-H,

              That’s awesome, and thank you so much for the detailed information. Feel free to post any update here to help the community.

              And don't doubt to contact us if you need help.

              Have a nice day.

              Regards,
              -Leonardo