• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Modify Restore Image Script

Scheduled Pinned Locked Moved
General
3
10
4.5k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    menteora
    last edited by Mar 5, 2012, 9:48 PM

    Hi to all,
    I modified the init.gz file system to fix automatically the mbr with ms-sys.

    Where is the script that does the repair of the image?
    I want to put my code at the end of the script file.

    thanks,
    menteora

    1 Reply Last reply Reply Quote 0
    • K
      keltorsori
      last edited by Mar 5, 2012, 10:59 PM

      Any chance you can share your init.gz fix? No matter what I do to my windows 7 images, I always have to go repair them after I deploy.

      1 Reply Last reply Reply Quote 0
      • J
        jdd49
        last edited by Mar 6, 2012, 12:53 PM

        [QUOTE]Where is the script that does the repair of the image?
        [/QUOTE]
        If you mean restore of the image, it is located at bin/fog inside of init

        1 Reply Last reply Reply Quote 0
        • M
          menteora
          last edited by Mar 6, 2012, 2:26 PM

          [QUOTE]If you mean restore of the image, it is located at bin/fog inside of init [/QUOTE]
          thanks, that’s what I meant.

          [QUOTE]Any chance you can share your init.gz fix? No matter what I do to my windows 7 images, I always have to go repair them after I deploy.
          [/QUOTE]
          Of course, I will share it when I will implement it in bin/fog file

          1 Reply Last reply Reply Quote 0
          • M
            menteora
            last edited by Mar 6, 2012, 5:54 PM

            This is my work:

            • I downloaded and compiled ms-sys ([url]http://ms-sys.sourceforge.net/[/url])
            • I copied the ms-sys binary file into bin folder of init.gz file system
            • I copied the library that use ms-sys into lib folder of init.gz file system (use [QUOTE]ldd /usr/local/bin/ms-sys[/QUOTE] to discover the dependencies)
            • (optional) I copied the sfdisk binary into sbin folder to fix the boot flag (if is necessary after fix mbr)
            • After this row in bin/fog:

            [QUOTE]echo " * Image Restored";
            done[/QUOTE]

            I inserted the following command:

            [QUOTE]if [ “$osid” == “1” ]
            then
            echo " * Fix Windows Xp Mbr:“;
            echo
            ms-sys -m /dev/sda
            echo
            echo " * Restore Flag Boot:”;
            sfdisk -A1 /dev/sda
            fi[/QUOTE]

            As you can see, I tested it only in Windows Xp with a multipartition disk image.

            I hope could be useful,
            menteora

            1 Reply Last reply Reply Quote 0
            • M
              menteora
              last edited by Mar 8, 2012, 8:56 AM

              [quote=“keltorsori, post: 1880, member: 607”]Any chance you can share your init.gz fix? No matter what I do to my windows 7 images, I always have to go repair them after I deploy.[/quote]

              I forgot to say that ms-sys allows to fix the other operating systems:
              [INDENT]-7, --mbr7 Write a Windows 7 MBR to device
              -i, --mbrvista Write a Windows Vista MBR to device
              -m, --mbr Write a Windows 2000/XP/2003 MBR to device
              -9, --mbr95b Write a Windows 95B/98/98SE/ME MBR to device
              -d, --mbrdos Write a DOS/Windows NT MBR to device[/INDENT]
              You can try,
              by
              menteora

              1 Reply Last reply Reply Quote 0
              • J
                jdd49
                last edited by Mar 8, 2012, 2:10 PM

                I just wanted to add a comment. I’m not sure exactly what the ms-sys program does, but Fog essentially already does the same thing. Fog has the standard mbr’s for xp, vista, and 7 stored in init.gz. It restores them with the command
                [B]dd if=$mbrfile of=$hd bs=512 count=1 &>/dev/null[/B]
                It looks to me that ms-sys is restoring the same standard mbr, if you restore the standard mbr to a system that doesn’t use the standard mbr, such as a system with 2 or 3 partitions, then it probably won’t boot.
                Just some thoughts.

                1 Reply Last reply Reply Quote 0
                • M
                  menteora
                  last edited by Mar 8, 2012, 4:31 PM

                  [quote=“jdd49, post: 2005, member: 623”]I just wanted to add a comment. I’m not sure exactly what the ms-sys program does, but Fog essentially already does the same thing. Fog has the standard mbr’s for xp, vista, and 7 stored in init.gz. It restores them with the command
                  [B]dd if=$mbrfile of=$hd bs=512 count=1 &>/dev/null[/B]
                  It looks to me that ms-sys is restoring the same standard mbr, if you restore the standard mbr to a system that doesn’t use the standard mbr, such as a system with 2 or 3 partitions, then it probably won’t boot.
                  Just some thoughts.[/quote]

                  Hi jdd49,
                  ms-sys fix the mbr, don’t restore the standard one, it’s similar to windows recovery console fixmbr command.
                  I tested ms-sys on a Lenovo pc with 2 partitions (recovery and windows xp) and worked well.

                  menteora

                  1 Reply Last reply Reply Quote 0
                  • J
                    jdd49
                    last edited by Mar 8, 2012, 5:38 PM

                    I checked out the source of that program, I am just trying to figure out why this works for you but yet the fog method doesn’t. It seems ms-sys restores only the first 446 bytes of the mbr, that is why your partition table stays intact enabling your multiple partitions to still work. Fog restores all 512 bytes which includes the partition table and then depending on your image type it gets deleted anyway and replaced with a new partition table. Seems strange that this solution works for you and fog on it’s own does not, like i said they are essentially doing the same thing. But hey, whatever works is what you should use.

                    1 Reply Last reply Reply Quote 0
                    • M
                      menteora
                      last edited by Mar 12, 2012, 7:23 PM

                      Thanks for your support, is very interesting that you found.
                      Can I make some additional tests?

                      menteora

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      1 / 1
                      • First post
                        10/10
                        Last post

                      165

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project