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

Parted returning a decimal point for start size in Kb

Scheduled Pinned Locked Moved
FOG Problems
2
7
2.3k
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.
  • E
    Eric Johnson
    last edited by Jun 17, 2014, 5:06 PM

    Hi folks, me again.

    fog 1.1.1, SL6.5 base, fresh install not upgrade.

    Yesterday I posted about getting into debug mode to try to figure out why an upload I was trying was failing.
    Thanks for the clue!!

    I think I have figured out the cause of the problem, but I am not 100% about my solution.

    In the init filesystem bin/fog.upload line 139ish $win7part1start is set via the output of a parted command.
    In my case the returned value after the parted | sed pipeline was 32.3

    So when that gets used to:

    adjustedfdsize=expr $sizefd '+' $win7part1start;

    expr returns: expr: non-numeric argument

    and adjustedfdsize is blank…

    so later when the partition is “adjusted” (IE deleted and recreated) the recreate fails so when
    it trys to partclone, partclone fails to find $part ( /dev/sda1 in my case)

    Im thinking a wipe of decimal place and beyond could be the fix

    Line 139 changed to:

    win7part1start=parted -s $hd u kB print | sed -e '/^.1/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB .*//' -e 's/\..*$//'

    and line 148 too.

    Thoughts?

    1 Reply Last reply Reply Quote 0
    • E
      Eric Johnson
      last edited by Jun 17, 2014, 6:49 PM

      And a follow up. Ran into another issue, perhaps related… For windows 7 images (osid 5) it seems to think partitions
      always start at 2048sector (line 145) But my windows 7 partiton in this case starts at 63…

      So after the recreate partclone.ntfs doesn’t see a ntfs filesystem on sda1 (starting at sector 2048)
      If I set it back to 63 it works.

      Why 2048 and not ${partitionStart}s sectors?

      Or maybe osid 5 should not be in that if statement at line 137, just do the fancy resize stuff for win8/8.1 ?

      Or maybe I have a goofy win7 system? (the system in question is a virtual box VM)

      Any clue bat application woul be appreciated. Im very far from a windows grue, so my understanding of what is normal or abnormal in the partition set up is quite sparse…

      1 Reply Last reply Reply Quote 0
      • T
        Tom Elliott
        last edited by Jun 17, 2014, 8:13 PM

        Normally, advanced format disks use start sector 2048. I’m going to guess your hdd is setup as IDE?

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • E
          Eric Johnson
          last edited by Jun 19, 2014, 1:45 PM

          Yep, it is a IDE disk in a VirtualBox vm.

          So I am wondering why not just use the partitionStart variable when having parted resize the disk. IE make no assumptions about what/where the single partition starts. (not sure about multi-partition setups, we don’t use them here)

          Here is a diff for fog.upload that fixes this and the decimal point problem mentioned earlier. When doing the steps “manually” this seems to work. Ill be trying a full script run upload later this morning.

          (don’t know if this is a good place to send bug fix diffs, so enlighten me if there is a better way)

          E

          — fog.upload.dist 2014-06-19 09:07:10.000000000 -0400
          +++ fog.upload 2014-06-19 09:32:02.000000000 -0400
          @@ -94,8 +94,8 @@
          fi
          fi
          diskSize=parted -s $hd u kB print | grep "Disk" | grep -v "Flags" | sed 's/Disk \/dev\/[a-zA-Z0-9]*: //' | sed 's/kB//';

          •                   partitionStart=`fdisk -lu | grep $part | awk '{print $3}'`;
                              if [ "$osid" == "1" ]; then
            
          •                           partitionStart=`fdisk -lu | grep $part | awk '{print $3}'`;
                                      if [ "$partitionStart" == "" ]; then
                                              partitionStart="63";
                                      fi
            

          @@ -136,22 +136,22 @@
          echo “Done”;
          if [ “$osid” == “5” ] || [ “$osid” == “6” ] || [ “$osid” == “7” ]; then
          if [ “$win7partcnt” == “1” ]; then

          •                                                   win7part1start=`parted -s $hd u kB print | sed -e '/^.1/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//'`;
            
          •                                                   win7part1start=`parted -s $hd u kB print | sed -e '/^.1/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//' -e 's/\..*$//'`;
                                                              if [ "$win7part1start" == "" ]; then
                                                                      handleError "Unable to determine disk start location.";
                                                              fi
                                                              adjustedfdsize=`expr $sizefd '+' $win7part1start`;
                                                              parted -s $hd u kB rm 1 &>/dev/null;
            
          •                                                   parted -s $hd -a opt u kB mkpart primary ntfs 2048s ${adjustedfdsize}kB &>/dev/null;
            
          •                                           parted -s $hd u kB set 1 boot on &>/dev/null
            
          •                                                   parted -s $hd -a opt u kB mkpart primary ntfs ${partitionStart}s ${adjustedfdsize}kB &>/dev/null;
            
          •                                                   parted -s $hd u kB set 1 boot on &>/dev/null
                                                      elif [ "$win7partcnt" == "2" ]; then
            
          •                                                   win7part2start=`parted -s $hd u B print | sed -e '/^.2/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//'`;
            
          •                                                   win7part2start=`parted -s $hd u B print | sed -e '/^.2/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//' -e 's/\..*$//'`;
                                                              if [ "$win7part2start" == "" ]; then
                                                                      handleError "Unable to determine disk start location.";
                                                              fi
                                                              adjustedfdsize=`expr $sizefd '+' $win7part2start`;
                                                              parted -s $hd -a opt u kB mkpart primary ntfs ${defaultpart2start}B ${adjustedfdsize}kB &>/dev/null;
            
          •                                           parted -s $hd u kB set 1 boot on &>/dev/null
            
          •                                                   parted -s $hd u kB set 1 boot on &>/dev/null
                                                      else
                                                              handleError "Invalid partition count.";
                                                      fi
            
          1 Reply Last reply Reply Quote 0
          • E
            Eric Johnson
            last edited by Jun 19, 2014, 1:48 PM

            Well… that diff post didn’t work too well eh? 🙂 Ill try a file upload…

            [url=“/_imported_xf_attachments/1/1022_diff.txt?:”]diff.txt[/url]

            1 Reply Last reply Reply Quote 0
            • T
              Tom Elliott
              last edited by Jun 19, 2014, 6:17 PM

              [quote=“Eric Johnson, post: 30794, member: 24659”]Well… that diff post didn’t work too well eh? 🙂 Ill try a file upload…[/quote]

              I’ll take a look when I get home tonight.

              Thanks for the info
              in the future, to add snippets of code use the [ c o d e ] [ / c o d e ] tags to wrap the code. It will come out much nicer. Remove the spaces of course for it to work properly.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              1 Reply Last reply Reply Quote 0
              • E
                Eric Johnson
                last edited by Jun 19, 2014, 6:39 PM

                Ok, testing 🙂

                [code]
                — fog.upload.dist 2014-06-19 09:07:10.000000000 -0400
                +++ fog.upload 2014-06-19 09:32:02.000000000 -0400
                @@ -94,8 +94,8 @@
                fi
                fi
                diskSize=parted -s $hd u kB print | grep "Disk" | grep -v "Flags" | sed 's/Disk \/dev\/[a-zA-Z0-9]*: //' | sed 's/kB//';

                •                   partitionStart=`fdisk -lu | grep $part | awk '{print $3}'`;
                                    if [ "$osid" == "1" ]; then
                  
                •                           partitionStart=`fdisk -lu | grep $part | awk '{print $3}'`;
                                            if [ "$partitionStart" == "" ]; then
                                                    partitionStart="63";
                                            fi
                  

                @@ -136,22 +136,22 @@
                echo “Done”;
                if [ “$osid” == “5” ] || [ “$osid” == “6” ] || [ “$osid” == “7” ]; then
                if [ “$win7partcnt” == “1” ]; then

                •                                                   win7part1start=`parted -s $hd u kB print | sed -e '/^.1/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//'`;
                  
                •                                                   win7part1start=`parted -s $hd u kB print | sed -e '/^.1/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//' -e 's/\..*$//'`;
                                                                    if [ "$win7part1start" == "" ]; then
                                                                            handleError "Unable to determine disk start location.";
                                                                    fi
                                                                    adjustedfdsize=`expr $sizefd '+' $win7part1start`;
                                                                    parted -s $hd u kB rm 1 &>/dev/null;
                  
                •                                                   parted -s $hd -a opt u kB mkpart primary ntfs 2048s ${adjustedfdsize}kB &>/dev/null;
                  
                •                                           parted -s $hd u kB set 1 boot on &>/dev/null
                  
                •                                                   parted -s $hd -a opt u kB mkpart primary ntfs ${partitionStart}s ${adjustedfdsize}kB &>/dev/null;
                  
                •                                                   parted -s $hd u kB set 1 boot on &>/dev/null
                                                            elif [ "$win7partcnt" == "2" ]; then
                  
                •                                                   win7part2start=`parted -s $hd u B print | sed -e '/^.2/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//'`;
                  
                •                                                   win7part2start=`parted -s $hd u B print | sed -e '/^.2/!d' -e 's/^ [0-9]*[ ]*//' -e 's/kB  .*//' -e 's/\..*$//'`;
                                                                    if [ "$win7part2start" == "" ]; then
                                                                            handleError "Unable to determine disk start location.";
                                                                    fi
                                                                    adjustedfdsize=`expr $sizefd '+' $win7part2start`;
                                                                    parted -s $hd -a opt u kB mkpart primary ntfs ${defaultpart2start}B ${adjustedfdsize}kB &>/dev/null;
                  
                •                                           parted -s $hd u kB set 1 boot on &>/dev/null
                  
                •                                                   parted -s $hd u kB set 1 boot on &>/dev/null
                                                            else
                                                                    handleError "Invalid partition count.";
                                                            fi
                  

                [/code]

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  5/7
                  Last post

                136

                Online

                12.0k

                Users

                17.3k

                Topics

                155.2k

                Posts
                Copyright © 2012-2024 FOG Project