EHGNB Absent Member.
Absent Member.
2853 views

Scripted Image Format D Drive

Hi,

in my scripted image does by a notebook make a d:\ drive. But when the imageingprozess end and i log into a user the d drive is not formated. Can anyone say why the d drive is not formated. This is my script:


IMG_PARTITION1="38768"
IMG_PARTITION1_TYPE="NTFS"
IMG_EXTEND_LAST_PARTITION="1" #
CREATE_PARTITION2=0
IMG_PARTITION2_TYPE="NTFS"
IMG_MBR_FILE="Addons/MBR/mbr-xp-en"

if [ `hwinfo --bios | grep -ic "Latitude"` = "1" ];
then CREATE_PARTITION2=1;
fi

echo ${CREATE_PARTITION2}

IMG_DELETE_PARTITIONS ()
{
img pd1
img pd2
img pd3
img pd4
}

IMG_CREATE_PARTITIONS ()
{
img pc1 ${IMG_PARTITION1_TYPE} ${IMG_PARTITION1}
if [ ${CREATE_PARTITION2} = "1" ];then
img pc2 ${IMG_PARTITION2_TYPE}
fi
img pa1
}

IMG_CREATE_MBR ()
{
local ReturnCode
if [ ${IMG_MBR_FILE} != "" ];then
tftp ${PROXYADDR} -m binary -c get ${IMG_MBR_FILE} /tmp/mbr
if [ -f /tmp/mbr ];then
echo -e "\nRewriting Master Boot Record ...\n"
dd if=/tmp/mbr of=/dev/sda bs=446 count=1
dd if=/tmp/mbr of=/dev/hda bs=446 count=1
ReturnCode=$?
fi
fi
return ${ReturnCode:=0}
}

CHECK_HW ()
{
HWTYPE=`dmidecode -s system-product-name | sed 's/[ \t]*$//'`
}


CHECK_WSNAME ()
{
## Retrieve the workstation name from Image Safe Data
ZISNAME=`zisview computername`


## If there was no workstation name in Image Safe, retrieve the
## PC's Name from User
if [ -z "${ZISNAME}" ]; then
echo "Bitte den PC-Namen eingeben:"
read ZISNAME
## Set the workstation's name in Image Safe Data
zisedit computername=${ZISNAME}
fi

}

RESTORE_IMG ()
{
img rp $PROXYADDR "//$PROXYADDR/var/opt/novell/zenworks/content-repo/images/xp-base-sp3.zmg" a1:p1
img rp $PROXYADDR "//$PROXYADDR/var/opt/novell/zenworks/content-repo/images/sysprep-de.zmg" a1:p1
img rp $PROXYADDR "//$PROXYADDR/var/opt/novell/zenworks/content-repo/images/appbundle.zmg" a1:p1
img rp $PROXYADDR "//$PROXYADDR/var/opt/novell/zenworks/content-repo/images/${HWTYPE}.zmg" a1:p1
}



CHECK_HW
CHECK_WSNAME
IMG_DELETE_PARTITIONS
IMG_CREATE_MBR
IMG_CREATE_PARTITIONS
RESTORE_IMG


Thanks

Martin
Labels (2)
0 Likes
8 Replies
carfra11 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

Hello Martin,

I think the partition D is no formated because:

- you don't format it at any point
- when you make the restore of your images you restore always the partition 1 nothing to partition 2.

You can try to create a image that contain a partition 😧 formated and then add to you script to retore it, something like that:

img rp xp-base-sp3.zmg" -ap=a1:p1 -ap=a2:p2.

Could you explain me what do you do to recreate the MBR, sometimes I have issues with boot disk and now all that can I do is a diskpart -clear (windows command from a live cd).
I'm interesting in recreate or fix the MBR with a linux command.

Regards
0 Likes
jlo555 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

Hi there,

Was there a solution for this?

I'm having this same problem with an unformatted 😧 drive on Win XP SP3.

I'm using:
Novell ZENworks Imaging Engine 10.3.1.0
linux kernel 2.6.32.12-0.7-default

There are two .zmg files (C and D). Both were created in Image Explorer and formatted with ntfs.

From maintenance mode:
first partition: img pc1 ntfs 60000
second partition: img pc2 ntfs

I used img pd2 to delete the partition and tried again with the same results. Anyone have any suggestions?
0 Likes
jlo555 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

I just tried formatting as fat32 (img pc2 fat32) which formatted properly in Win XP, imaged with a D-Drive.zmg. Again, no such luck with ntfs. Is this a bug or am I doing something wrong?
0 Likes
shaunpond Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

Ehgnb,

you're not putting any content on the 😧 drive, are you? Restore an
"empty" partition...

--

Shaun Pond


0 Likes
jlo555 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

spond;2069954 wrote:
Ehgnb,

you're not putting any content on the 😧 drive, are you? Restore an
"empty" partition...

--

Shaun Pond


Hi Shaun,

These are some of the commands I had run in the shell script:
img pc1 ntfs 60000
img pc2 ntfs
img rp XP-Base.zmg a1:p1
img rp D-Drive.zmg a2:p2
img pa1
reboot -f

The D-Drive image was created after the Base image was restored to C: drive. The D image was formatted as ntfs, then Image Explorer was used to create the image. When you mentioned content on the D drive, I had gone back and noticed some hidden files in Image Explorer. Those files were marked for removal so they should not be restored on the 😧 drive.

I had used "img pc2 fat32" to format the D partition which was successful but I don't understand why formatting as ntfs will not work for me.

Julie
0 Likes
jlo555 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

Hi there,

I solved my own problem. The one command should have had "a1:p2" instead of "a2:p2" when restoring the image.

correct command: img rp D-Drive.zmg a1:p2

Julie
0 Likes
shaunpond Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

Jlo555,

glad you spotted that, I don't think I'd have been able to work that
out without a copy of your image... 🙂

--

Shaun Pond


0 Likes
jlo555 Absent Member.
Absent Member.

Re: Scripted Image Format D Drive

spond;2071098 wrote:
Jlo555,

glad you spotted that, I don't think I'd have been able to work that
out without a copy of your image... 🙂

--

Shaun Pond


Hi Shaun,

I forgot to mention that I used the original image and did not remove any hidden files. Those, I believe, are necessary since the image with the removed files simply did not work.

I just hope that if there are others encountering the same issue, this will help them.

Cheers,
Julie
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.