Wrong Partition is mounted during deployment. (FOG 1.5.7.56)

  • Testers

    I am using the postdownload scripts function to replace files on the os.
    I have recently created a golden image of Windows 10 build 2004 and something has changed.
    The image is a GPT image.
    When deploying the image to the client pc it fails with:
    alt text

    the OS partition is /dev/sda3

    any ideas on how to fix this?

    *** EDIT
    I went back to the golden image and used diskpart to delete partition 4 which is the Recovery Partition.

    diskpart
    select disk 0
    select partition 4
    delete partition override
    exit
    

    re-syspreped and uploaded to fogserver.

  • Testers

    @george1421 said in Wrong Partition is mounted during deployment. (FOG 1.5.7.56):

    @Greg-Plamondon You might want to update your partition detection script to the one used here:

    #!/bin/bash
    . /usr/share/fog/lib/funcs.sh
    [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
    case $osid in
        5|6|7|9)
            clear
            [[ ! -d /ntfs ]] && mkdir -p /ntfs
            getHardDisk
            if [[ -z $hd ]]; then
                handleError "Could not find hdd to use"
            fi
            getPartitions $hd
            for part in $parts; do
                umount /ntfs >/dev/null 2>&1
                fsTypeSetting "$part"
                case $fstype in
                    ntfs)
                        dots "Testing partition $part"
                        ntfs-3g -o force,rw $part /ntfs
                        ntfsstatus="$?"
                        if [[ ! $ntfsstatus -eq 0 ]]; then
                            echo "Skipped"
                            continue
                        fi
                        if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                            echo "Not found"
                            umount /ntfs >/dev/null 2>&1
                            continue
                        fi
                        echo "Success"
                        break
                        ;;
                    *)
                        echo " * Partition $part not NTFS filesystem"
                        ;;
                esac
            done
            if [[ ! $ntfsstatus -eq 0 ]]; then
                echo "Failed"
                debugPause
                handleError "Failed to mount $part ($0)\n    Args: $*"
            fi
            echo "Done"
            debugPause
            . ${postdownpath}fog.copydrivers
            # . ${postdownpath}fog.updateunattend
            umount /ntfs
            ;;
        *)
            echo "Non-Windows Deployment"
            debugPause
            return
            ;;
    esac
    

    This one uses a bit more intelligence to find which partition actually has windows on it. I think your script is just picking the last partition and calling it good enough.

    ref: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

    Thanks, That fixed it!

  • Moderator

    @Greg-Plamondon said in Wrong Partition is mounted during deployment. (FOG 1.5.7.56):

             for part in $parts; do
                 true
             done
    

    This is the section that needs tweaking on your script. This bit really doesn’t do anything, It loops through the partitions and says true.

  • Moderator

    @Greg-Plamondon You might want to update your partition detection script to the one used here:

    #!/bin/bash
    . /usr/share/fog/lib/funcs.sh
    [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
    case $osid in
        5|6|7|9)
            clear
            [[ ! -d /ntfs ]] && mkdir -p /ntfs
            getHardDisk
            if [[ -z $hd ]]; then
                handleError "Could not find hdd to use"
            fi
            getPartitions $hd
            for part in $parts; do
                umount /ntfs >/dev/null 2>&1
                fsTypeSetting "$part"
                case $fstype in
                    ntfs)
                        dots "Testing partition $part"
                        ntfs-3g -o force,rw $part /ntfs
                        ntfsstatus="$?"
                        if [[ ! $ntfsstatus -eq 0 ]]; then
                            echo "Skipped"
                            continue
                        fi
                        if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                            echo "Not found"
                            umount /ntfs >/dev/null 2>&1
                            continue
                        fi
                        echo "Success"
                        break
                        ;;
                    *)
                        echo " * Partition $part not NTFS filesystem"
                        ;;
                esac
            done
            if [[ ! $ntfsstatus -eq 0 ]]; then
                echo "Failed"
                debugPause
                handleError "Failed to mount $part ($0)\n    Args: $*"
            fi
            echo "Done"
            debugPause
            . ${postdownpath}fog.copydrivers
            # . ${postdownpath}fog.updateunattend
            umount /ntfs
            ;;
        *)
            echo "Non-Windows Deployment"
            debugPause
            return
            ;;
    esac
    

    This one uses a bit more intelligence to find which partition actually has windows on it. I think your script is just picking the last partition and calling it good enough.

    ref: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

  • Testers

    @george1421
    Here is my fog.postdownload

    #!/bin/bash
    . /usr/share/fog/lib/funcs.sh
    curl -A "" -Lkso /tmp/hinfo.sh "${web}/service/hostinfo.php?mac=$mac"
    . /tmp/hinfo.sh
    [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
    case $osid in
        5|6|7|9)
            clear
            [[ ! -d /ntfs ]] && mkdir -p /ntfs
            getHardDisk
            if [[ -z $hd ]]; then
                handleError "Could not find hdd to use"
    
            fi
            getPartitions $hd
            for part in $parts; do
                true
            done
            dots "Mounting partition $part"
            ntfs-3g -o force,rw $part /ntfs >/dev/null 2>&1
            if [[ ! $? -eq 0 ]]; then
                echo "Failed"
                debugPause
                handleError "Failed to mount $part ($0)\n    Args: $*"
            fi
            echo "Done"
            case $othertag in
               [Bb][Aa][Yy])
                    . ${postdownpath}fog.log
                    . ${postdownpath}fog.replace-files_bay
                    . ${postdownpath}fog.drivers
                    . ${postdownpath}fog.ad_bay
                    . ${postdownpath}fog.DesktopInfo
                    ;;
               [Mm][Pp][Mm][Ii])
                    . ${postdownpath}fog.log
                    . ${postdownpath}fog.replace-files_mpmi
                    . ${postdownpath}fog.drivers
                    . ${postdownpath}fog.ad_mpmi
                    . ${postdownpath}fog.DesktopInfo
                    ;;
               [Hh][Oo][Mm][Ee])
                    . ${postdownpath}fog.log
                    . ${postdownpath}fog.replace-files_home
                    . ${postdownpath}fog.drivers
                    ;;
               [Mm][Tt][Ss])
                    . ${postdownpath}fog.log
                    . ${postdownpath}fog.replace-files_fog
                    . ${postdownpath}fog.drivers
                    . ${postdownpath}fog.ad_bay
                    . ${postdownpath}fog.DesktopInfo
                    ;;
                 *)
    

    we use the $othertag to do different things for our sister companies.

    How is $part determined?

  • Moderator

    I was able to capture Windows 10 2004 UEFI from a source system with a 70GB disk and deploy it to a target system (VM) with 50GB disk. It deployed/booted and resized the disk without issue. Again my base image doesn’t have the recovery partition. Next week I schedule a new build task in MDT and leave the recovery partition in place at the end of the partition chain to see what happens on a deploy and resize. But for my use case 2004 works correctly deploying to a VM.

  • Moderator

    @Greg-Plamondon said in Wrong Partition is mounted during deployment. (FOG 1.5.7.56):

    do you mind sharing your complex post download script with me

    Sorry I will not do that because that is our secret sauce. But I can tell you I’ve documented it in the tutorials.

    https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

    And in parts 3, 4 and 5 here:
    https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script

  • Moderator

    @Greg-Plamondon said in Wrong Partition is mounted during deployment. (FOG 1.5.7.56):

    Fog mounts /dev/sda3 which, in this case, is partition 3 the Recovery partition.

    Why is this the case. What makes FOG pick /dev/sda3. I think that may be the question here.

    The recovery partition being the last parition on the disk may be the issue with expanding or contracting the disk using “single disk resizable” within FOG in regards to 2004.

  • Testers

    @george1421 do you mind sharing your complex post download script with me 🙂

  • Testers

    well, I thought I had it licked but here is the issue with Windows 10 version 2004 MBR image.
    It creates 3 partitions but they are in the wrong order.

    Fog mounts /dev/sda3 which, in this case, is partition 3 the Recovery partition.

    alt text

    Here is the lsblk for the VM golden image.

    alt text

  • Moderator

    I’m currently building a 2004 reference image in my MDT environment. I’ve kind of held off because of the issues around 2004. But lets see if I can duplicate what you see. With MDT I have it setup to not create the recovery partition (partition 4) by default. Lets see if everything works out of the box with 2004 and deploying using a complex post download script that I have.

    I do see a number of folks reporting issues with FOG and cloning a 2004 based image so there may be some changes MS did to the disk structure.

378
Online

7.7k
Users

14.7k
Topics

138.4k
Posts