Loading ...
Sorry, an error occurred while loading the content.

Re: [nslu2-linux] Backup on openWrt

Expand Messages
  • Rod Whitby
    ... The rootfs_data partition (/dev/mtdblock/4) is a subset of the rootfs partition (which is squashfs, with the empty space converted to a jffs mini-fo
    Message 1 of 12 , Jan 2, 2009
    • 0 Attachment
      lance_benson wrote:
      > I am running openWrt Kamikazi 7.09 on a slug with no external memory.
      > I tried a backup method which has been posted a number of times for
      > other NSLU2 OSs:
      >
      > cat /dev/mtdblock* > /tmp/backup-image.bin
      >
      > (I first made the jffs read-only with:
      > mount -o remount,ro /dev/mtdblock/4 /jffs
      >
      > and afterwards remounted it with:
      > mount -o remount,rw /dev/mtdblock/4 /jffs
      >
      > The backup-image.bin file is 14 megabytes, not the eight I expected.
      > How do I make a reflashable backup image of NSLU2 openWrt?

      The rootfs_data partition (/dev/mtdblock/4) is a subset of the rootfs
      partition (which is squashfs, with the empty space converted to a jffs
      mini-fo overlay). So you need to skip /dev/mtdblock/4 when you are
      concatenating them together.

      Use dmesg to see the kernel printout of the mapping of the MTD
      partitions to confirm what I've written from memory above, before you
      rely on that backup.

      -- Rod
    • lance_benson
      ... I m feeling my way here. With Kamikazi 7.09 on a NSLU2 with no external memory, from dmesg, I have the following: Searching for RedBoot partition table in
      Message 2 of 12 , Jan 3, 2009
      • 0 Attachment
        >Use dmesg to see the kernel printout of the mapping of the MTD
        >partitions to confirm what I've written from memory above, before you
        >rely on that backup.
        >-- Rod

        I'm feeling my way here. With Kamikazi 7.09 on a NSLU2 with no
        external memory, from dmesg, I have the following:

        Searching for RedBoot partition table in IXP4XX-Flash.0 at offset
        0x7e0000
        6 RedBoot partitions found on MTD device IXP4XX-Flash.0
        Creating 6 MTD partitions on "IXP4XX-Flash.0":
        0x00000000-0x00040000 : "RedBoot"
        nslu2 mac: 00:13:10:d7:f0:f8
        0x00040000-0x00060000 : "SysConf"
        0x00060000-0x00080000 : "Loader"
        0x00080000-0x00180000 : "Kernel"
        0x00180000-0x007e0000 : "rootfs"
        0x00280000-0x007e0000 : "rootfs_data"
        0x007e0000-0x00800000 : "FIS directory"

        In dev, I have the following:

        brw-r--r-- 1 root root 31, 0 Dec 31 1969 mtdblock0
        brw-r--r-- 1 root root 31, 1 Dec 31 1969 mtdblock1
        brw-r--r-- 1 root root 31, 2 Dec 31 1969 mtdblock2
        brw-r--r-- 1 root root 31, 3 Dec 31 1969 mtdblock3
        brw-r--r-- 1 root root 31, 4 Dec 31 1969 mtdblock4
        brw-r--r-- 1 root root 31, 5 Dec 31 1969 mtdblock5
        brw-r--r-- 1 root root 31, 6 Dec 31 1969 mtdblock6

        Do these correspond? I note that "rootfs_data" is contained in and
        is a large subset of "rootfs".

        If I run the following, omitting mtdblock5:

        dd if=/dev/mtdblock0 > /tmp/NSLU2C_image.bin
        dd if=/dev/mtdblock1 >> /tmp/NSLU2C_image.bin
        dd if=/dev/mtdblock2 >> /tmp/NSLU2C_image.bin
        dd if=/dev/mtdblock3 >> /tmp/NSLU2C_image.bin
        dd if=/dev/mtdblock4 >> /tmp/NSLU2C_image.bin
        dd if=/dev/mtdblock6 >> /tmp/NSLU2C_image.bin

        I get the following file:
        -rw-r--r-- 1 root root 8388608 Jan 3 08:22
        NSLU2C_image.bin

        By a happy coincidence (or not), the file size is exactly the same as
        the 7.09 image file which I flashed originally (8,192 Kbytes * 1024 =
        8388608). Should this give me what I want? Should I first make
        mtdblock4 read-only? Is there a one-line version of this?
      • Rod Whitby
        Yep, that corresponds. Note how omitting the rootfs_data partition means that the addresses for the remaining partitions follow on from each other perfectly
        Message 3 of 12 , Jan 3, 2009
        • 0 Attachment
          Yep, that corresponds. Note how omitting the rootfs_data partition means that the addresses for the remaining partitions follow on from each other perfectly up to the full 8MB.
          Please update the wiki with this new information.
          -- Rod

          -----Original Message-----
          From: "lance_benson" <lance_benson@...>
          Date: Sunday, Jan 4, 2009 12:07 am
          Subject: [nslu2-linux] Re: Backup on openWrt
          To: nslu2-linux@yahoogroups.comReply-To: nslu2-linux@yahoogroups.com

          >Use dmesg to see the kernel printout of the mapping of the MTD
          >partitions to confirm what I've written from memory above, before you
          >rely on that backup.
          >-- Rod
          >
          >I'm feeling my way here. With Kamikazi 7.09 on a NSLU2 with no
          >external memory, from dmesg, I have the following:
          >
          >Searching for RedBoot partition table in IXP4XX-Flash.0 at offset
          >0x7e0000
          >6 RedBoot partitions found on MTD device IXP4XX-Flash.0
          >Creating 6 MTD partitions on "IXP4XX-Flash.0":
          >0x00000000-0x00040000 : "RedBoot"
          >nslu2 mac: 00:13:10:d7:f0:f8
          >0x00040000-0x00060000 : "SysConf"
          >0x00060000-0x00080000 : "Loader"
          >0x00080000-0x00180000 : "Kernel"
          >0x00180000-0x007e0000 : "rootfs"
          >0x00280000-0x007e0000 : "rootfs_data"
          >0x007e0000-0x00800000 : "FIS directory"
          >
          >In dev, I have the following:
          >
          >brw-r--r-- 1 root root 31, 0 Dec 31 1969 mtdblock0
          >brw-r--r-- 1 root root 31, 1 Dec 31 1969 mtdblock1
          >brw-r--r-- 1 root root 31, 2 Dec 31 1969 mtdblock2
          >brw-r--r-- 1 root root 31, 3 Dec 31 1969 mtdblock3
          >brw-r--r-- 1 root root 31, 4 Dec 31 1969 mtdblock4
          >brw-r--r-- 1 root root 31, 5 Dec 31 1969 mtdblock5
          >brw-r--r-- 1 root root 31, 6 Dec 31 1969 mtdblock6
          >
          >Do these correspond? I note that "rootfs_data" is contained in and
          >is a large subset of "rootfs".
          >
          >If I run the following, omitting mtdblock5:
          >
          >dd if=/dev/mtdblock0 > /tmp/NSLU2C_image.bin
          >dd if=/dev/mtdblock1 >> /tmp/NSLU2C_image.bin
          >dd if=/dev/mtdblock2 >> /tmp/NSLU2C_image.bin
          >dd if=/dev/mtdblock3 >> /tmp/NSLU2C_image.bin
          >dd if=/dev/mtdblock4 >> /tmp/NSLU2C_image.bin
          >dd if=/dev/mtdblock6 >> /tmp/NSLU2C_image.bin
          >
          >I get the following file:
          >-rw-r--r-- 1 root root 8388608 Jan 3 08:22
          >NSLU2C_image.bin
          >
          >By a happy coincidence (or not), the file size is exactly the same as
          >the 7.09 image file which I flashed originally (8,192 Kbytes * 1024 =
          >8388608). Should this give me what I want? Should I first make
          >mtdblock4 read-only? Is there a one-line version of this?
          >
          >
          >
          >
          >------------------------------------
          >
          >Yahoo! Groups Links
          >
          >
          >
          >
        • lance_benson
          Ok, Rod, thanks for your suggestions. The following works for me (I don t know if the mount r/o and remounts are needed--still awaiting feedback--and do I
          Message 4 of 12 , Jan 3, 2009
          • 0 Attachment
            Ok, Rod, thanks for your suggestions. The following works for me (I
            don't know if the mount r/o and remounts are needed--still awaiting
            feedback--and do I have them specified right; should there be no
            slash before the "4"?):

            mount -o remount,ro /dev/mtdblock/4 /jffs
            dd if=/dev/mtdblock0 > /tmp/NSLU2C_image.bin
            dd if=/dev/mtdblock1 >> /tmp/NSLU2C_image.bin
            dd if=/dev/mtdblock2 >> /tmp/NSLU2C_image.bin
            dd if=/dev/mtdblock3 >> /tmp/NSLU2C_image.bin
            dd if=/dev/mtdblock4 >> /tmp/NSLU2C_image.bin
            dd if=/dev/mtdblock6 >> /tmp/NSLU2C_image.bin
            mount -o remount,rw /dev/mtdblock/4 /jffs

            This produces a file in tmp, NSLU2C_image.bin, which is 8388608 bytes
            long, the size of the image which is flashed into the NSLU2. Note
            that the dds omit mtdblock5, which is a subset of mtdblock4.

            Now how to get this file back on my Windows PC. There is probably a
            simpler way, but I don't know it. I made the file available over
            http by running this:

            /usr/sbin/httpd -p 82 -h /tmp -c /etc/httpd.conf

            which makes port 82 available with the home directory of /tmp. My
            httpd.conf does not specify a password.

            Then from the PC I ran this PHP program (php must be available).

            <?php // GetNSimg.php gets NSLU2 openWrt firmware image file
            $Geturl = "http://192.168.1.77:82/NSLU2C_image.bin";
            $A = file_get_contents($Geturl);
            $fh = fopen("NSLU2C_image.bin", 'w') or die("Can't open file");
            fwrite($fh,$A);
            fclose($fh);
            ?>

            I then successfully flashed this image (using the Sercomm upgrade
            utility) onto a new NSLU2 for which I had not been able to find the
            IP address. I was able to access this NSLU2, change the ip address,
            and voila, a cloned openWrt 7.09 slug.

            I will update the wiki.
          • lance_benson
            I m ready to add the following page to the wiki, and a link from the openwrt homepage in the wiki, but I don t see how to add a new page. If someone can tell
            Message 5 of 12 , Jan 3, 2009
            • 0 Attachment
              I'm ready to add the following page to the wiki, and a link from the
              openwrt homepage in the wiki, but I don't see how to add a new page.
              If someone can tell me how to add a page, I'll also add a page
              telling how to add a page.

              Backup openWrt Kamikazi 7.09 flash

              ! Backup Flash on NSLU2 running openWrt Kamikazi 7.09

              Prepared Jan 3, 2009

              After advice from Rod Whitby this works to produce a backup of the
              flash which can be reflashed onto another (or the same) NSLU2 (no
              external device on this slug):

              dd if=/dev/mtdblock0 > /tmp/NSLU2C_image.bin
              dd if=/dev/mtdblock1 >> /tmp/NSLU2C_image.bin
              dd if=/dev/mtdblock2 >> /tmp/NSLU2C_image.bin
              dd if=/dev/mtdblock3 >> /tmp/NSLU2C_image.bin
              dd if=/dev/mtdblock4 >> /tmp/NSLU2C_image.bin
              dd if=/dev/mtdblock6 >> /tmp/NSLU2C_image.bin

              This produces a file in tmp, NSLU2C_image.bin, which is 8388608 bytes
              long, the size of the image which is flashed into the NSLU2. Note
              that the dds omit mtdblock5, which is a subset of mtdblock4--leaving
              it in produces an image which is too large.

              Now how to get this file back on a Windows PC. There is probably a
              simpler way, but you can made the file available over http by running
              this:

              /usr/sbin/httpd -p 82 -h /tmp -c /etc/httpd.conf

              which makes port 82 available with the home directory of /tmp. This
              httpd.conf does not specify a password.

              Then from the PC you can run this PHP program (php must be available).

              <?php // GetNSimg.php gets NSLU2 openWrt firmware image file
              $Geturl = "http://192.168.1.77:82/NSLU2C_image.bin";
              $A = file_get_contents($Geturl);
              $fh = fopen("NSLU2C_image.bin", 'w') or die("Can't open file");
              fwrite($fh,$A);
              fclose($fh);
              ?>

              This image can then successfully be flashed (using the Sercomm
              upgrade utility) onto a new NSLU2. You can access this NSLU2, change
              the ip address, and voila, a cloned openWrt 7.09 slug.
            • Rod Whitby
              ... The remount as ro is definitely a good idea, in case the jffs2 changes while copying. ... WinSCP. ... Thanks. -- Rod
              Message 6 of 12 , Jan 3, 2009
              • 0 Attachment
                lance_benson wrote:
                > Ok, Rod, thanks for your suggestions. The following works for me (I
                > don't know if the mount r/o and remounts are needed--still awaiting
                > feedback--and do I have them specified right; should there be no
                > slash before the "4"?):
                >
                > mount -o remount,ro /dev/mtdblock/4 /jffs
                > dd if=/dev/mtdblock0 > /tmp/NSLU2C_image.bin
                > dd if=/dev/mtdblock1 >> /tmp/NSLU2C_image.bin
                > dd if=/dev/mtdblock2 >> /tmp/NSLU2C_image.bin
                > dd if=/dev/mtdblock3 >> /tmp/NSLU2C_image.bin
                > dd if=/dev/mtdblock4 >> /tmp/NSLU2C_image.bin
                > dd if=/dev/mtdblock6 >> /tmp/NSLU2C_image.bin
                > mount -o remount,rw /dev/mtdblock/4 /jffs

                The remount as ro is definitely a good idea, in case the jffs2 changes
                while copying.

                > This produces a file in tmp, NSLU2C_image.bin, which is 8388608 bytes
                > long, the size of the image which is flashed into the NSLU2. Note
                > that the dds omit mtdblock5, which is a subset of mtdblock4.
                >
                > Now how to get this file back on my Windows PC. There is probably a
                > simpler way, but I don't know it.

                WinSCP.

                > I then successfully flashed this image (using the Sercomm upgrade
                > utility) onto a new NSLU2 for which I had not been able to find the
                > IP address. I was able to access this NSLU2, change the ip address,
                > and voila, a cloned openWrt 7.09 slug.
                >
                > I will update the wiki.

                Thanks.

                -- Rod
              • Rod Whitby
                ... Just type the name of the new page into the browser at the right place, and it will ask you if you want to start editing it. -- Rod
                Message 7 of 12 , Jan 3, 2009
                • 0 Attachment
                  lance_benson wrote:
                  > I'm ready to add the following page to the wiki, and a link from the
                  > openwrt homepage in the wiki, but I don't see how to add a new page.
                  > If someone can tell me how to add a page, I'll also add a page
                  > telling how to add a page.

                  Just type the name of the new page into the browser at the right place,
                  and it will ask you if you want to start editing it.

                  -- Rod
                • Rod Whitby
                  ... Actually, can you please just add it to the existing backup page? There s no need to add a new page for it when there s an existing page on howto backup
                  Message 8 of 12 , Jan 3, 2009
                  • 0 Attachment
                    lance_benson wrote:
                    > I'm ready to add the following page to the wiki, and a link from the
                    > openwrt homepage in the wiki, but I don't see how to add a new page.
                    > If someone can tell me how to add a page, I'll also add a page
                    > telling how to add a page.

                    Actually, can you please just add it to the existing backup page?
                    There's no need to add a new page for it when there's an existing page
                    on howto backup the slug.

                    -- Rod
                  • lance_benson
                    ... Done, here: http://www.nslu2-linux.org/wiki/HowTo/CompletelyBackupTheNSLU2 with links added to several other backup pages. One question: the letters
                    Message 9 of 12 , Jan 3, 2009
                    • 0 Attachment
                      > Actually, can you please just add it to the existing backup page?

                      Done, here:
                      http://www.nslu2-linux.org/wiki/HowTo/CompletelyBackupTheNSLU2 with
                      links added to several other backup pages. One question: the
                      letters "NSLU2C" were underlined and followed by a guestion mark, with
                      a link suggesting that a wiki page be added for this. I don't know why
                      this was, or what to do about it.
                    • reuter.rudolf
                      ... wrote: One question: the ... Hello Lance, NSLU2C is interpreted as a wiki word. But that page does not exist. In order to remove that interpretation just
                      Message 10 of 12 , Jan 3, 2009
                      • 0 Attachment
                        --- In nslu2-linux@yahoogroups.com, "lance_benson" <lance_benson@...>
                        wrote:
                        One question: the
                        > letters "NSLU2C" were underlined and followed by a guestion mark, with
                        > a link suggesting that a wiki page be added for this. I don't know why
                        > this was, or what to do about it.
                        >
                        Hello Lance,
                        NSLU2C is interpreted as a wiki word. But that page does not exist. In
                        order to remove that interpretation just type [=NSLU2C=].
                        Please see also http://www.nslu2-linux.org/wiki/PmWiki/PmWiki
                        and http://www.nslu2-linux.org/wiki/PmWiki/MarkupMasterIndex
                        and search for "[=".
                        Greetings, Rudy
                      • lance_benson
                        ... Thanks, Rudy. I figured out that it was making a link, and fixed it by changing it to lower case. But I didn t know about [= --thanks for that tip.
                        Message 11 of 12 , Jan 3, 2009
                        • 0 Attachment
                          > In order to remove that [wiki word] interpretation just
                          > type [=NSLU2C=].

                          Thanks, Rudy. I figured out that it was making a link, and fixed it by
                          changing it to lower case. But I didn't know about "[="--thanks for
                          that tip.
                        Your message has been successfully submitted and would be delivered to recipients shortly.