5 Replies Latest reply on Oct 29, 2015 6:17 PM by CMata_Intel

    Migrating filesystem from card partition to ext3 loopback file

    Jaxter

      Long story short, I have Intel Galileo gen 1 board and Debian wheezy installed on micro sd card. Everything is fine and working. However, the problem is, that the card itself is partitioned, so the only way I can backup the linux installed there is to backup the whole sd card which is 8gb, while the installation is roughly 2gb. This is quite time consuming, because I like to backup frequently since I'm really new to linux. And it is just nice to have a single file to drag and drop into the card and it just works.

       

      The question is simple - How can I migrate the whole filesystem to a file and boot from it? Can anyone tell me what steps should I take?
      I know this is possible since there is "SD-Card Linux Image" on the page which works exactly this way, but is lacking in features (apt-get is very important for me). And please, do not suggest building my own yocto image - I have tried that and it did not work. That one is beyond my capabilities.

        • 1. Re: Migrating filesystem from card partition to ext3 loopback file
          mhahn

          I am not sure I completely get your issue.

          What do you need to backup? The whole root file system? Or only user data? On which OS do you want to run this? If you don't build your own system but base on an existing build (Debian in your case) all you need is the deltas to this build, right?

          You could for instance backup your files via rsync (which offers options to only sync updated files).

          • 2. Re: Migrating filesystem from card partition to ext3 loopback file
            Jaxter

            Sorry for not being clear enough.
            Debian wheezy is installed on sd card and the card itself is inserted in slot on galileo board. Galileo boots it nicely since I can ssh to it from my computer.
            But the card itself is partitioned, so there is one ~94mb FAT16 partition, where grub is, then there is ~400mb of unpartitioned space (as I'm aware) and then there's ~3gb ext3 partition where the whole Debian filesystem is, followed by unpartitioned space. Basically, a lot of space is wasted. I know I can resize the said ext3 partition with gparted or similar programs, but it's not the point - I will never need such a big filesystem.
            So, to save space on my card, I would like to migrate the whole root filesystem from the said ext3 partiton to a single file, so I could have my whole 8gb memory card formatted as fat32, but still be able to boot Debian on galileo when I insert my card into it.

            I have already tried to create empty ext3 block device (I think that's how they're called, right?) mount it and copy the contents of the root filesystem to it. I have also replaced bzimage and initramfs files with others (the ones from working installation, when card has multiple partitions) in grub.conf. But when I tried to boot it, the sd led indicator on board flashed 2 times, but could not boot into Debian.
            As for "deltas", I have no idea what that is...

            • 3. Re: Migrating filesystem from card partition to ext3 loopback file
              CMata_Intel

              Hi Jaxter,

               

              Do you have updates on this? I would like to know from where are you getting the Debian source files for building the image.

               

              Regards,

              Charlie

              • 4. Re: Migrating filesystem from card partition to ext3 loopback file
                Jaxter

                Hi ,

                 

                I am not building an image. I got the image file (IntelGalileoDebian2GB.img) from here: mdelgert/IntelGalileo · GitHub

                And that is the main problem - I cannot have a "single filesystem" file, since this image file has to be written to sd card and, in turn, sd card gets partitioned with multiple partitions and such. (Unless I don't know something, and files like these, can be easily "converted" to the thing that I need)

                 

                As for progress, I have not had any luck with what I mentioned before (creating empty filesystem file and copying/cloning the whole ext3 partition to it) - it just does not boot. Any idea on what I might be missing. Or maybe the way I'm doing it is just not possible?

                • 5. Re: Migrating filesystem from card partition to ext3 loopback file
                  CMata_Intel

                  Hi Jaxter,

                   

                  Some images needs to have these partitions. The SD card gets partitioned for purposes of the OS itself. The same thing happens with the EGLIBC image.

                  I suggest you to contact the owner of the image you are using: mdelgert (Matthew David Elgert) · GitHub or you can open an issue in his github to discuss this and check if the partitions are required for his build.

                   

                  Kind regards,

                  Charlie