TB Script that uses DOS and EMBR partition names for backup

User discussion and information resource forum for scripting of TeraByte products using script lanugages such as TBScript, VBScript, Batch Files, and more.
Post Reply
tas3086
Posts: 317
Joined: Mon Mar 19, 2012 6:15 pm

TB Script that uses DOS and EMBR partition names for backup

Post by tas3086 »

Attention IFD and IFL Users:
Do you have problems with using the IMAGE.EXE /b /uy /d:d0@0x1 /f:d2@0x2E4:" .... file and partition selection nomenclature?
If so, give this little script a try. It converts MBR and EMBR partition names into these disk and partition numbers that image.exe needs.
This is especially useful if you have USB drives, or plug and play sata drives installed, or if you move disks and or partitions around ... as the numbers change on each movement.

Heres the format of the (tbos) command:
IFDIMG2.TBS In_Drive_Label Out_Drive_Label [EXEC/NOEXEC] [Compression_Level]

Required parameters:
in_drive_label : the case sensitive MBR or EMBR partition name to be backed up (put in quotes for multi word names)
out_drive_label: specifies a case sensitive output partition name for the backup file. (file name is hardcoded in script)
optional parameters:
EXEC : Image command will be displayed and then run
NOEXEC: Default, the command to run image.exe will be displayed but will not be executed.
Compression_Level: defaults to 1. You can specify any supported compression level
-----------------------------------------------------------------------------------------------------------------------
I use this script to backup my key partitions. It calls the IFD2MG2.TBS script. I run it from my BOOTITBM selection menu.
Depending on what and where I have my disks installed, it finds them and backs them up. If they are not available, the script just continues to the next drive. Good luck, change as necessary for your system. As always there are no guarantees that this will work on your system, but it can probably be easily fixed !
-------------------------------------------
BU.TBS:
sub main()
EXEC ("IFDIMG2.TBS 56d5p1M-W7 ^"IDRIVE TB^" EXEC 1",1)
EXEC ("IFDIMG2.TBS LEXAR64MB I_DRIVE EXEC 2",1)
EXEC ("IFDIMG2.TBS LinuxMint I_DRIVE NOEXEC 2",1)
EXEC ("IFDIMG2.TBS CNEW52P1 I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS WinXP(32) I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS Win7(64) I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS Win7(32) I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS D_DRIVE I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS E_DRIVE I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS F_DRIVE I_DRIVE EXEC 1",1)
end sub
--------------------------------------------------------------------

Humm ....... The forum will not let me post the IFDIMG2.TBS script ... let me see what is going wrong. I'll be back
Last edited by tas3086 on Wed Feb 13, 2013 8:05 pm, edited 5 times in total.
tas3086
Posts: 317
Joined: Mon Mar 19, 2012 6:15 pm

heres the IFDIMG2.TBS script

Post by tas3086 »

sub main()
//130208 Change made to allow script to run on Image For Linux
if TBSENV = "DOS" then
txmode (64)
end if
fpxx="UNKNOWN"
tpxx="UNKNOWN"
comp=1
if argc() < 2 then
printl (argc(),"exiting")
printl ("Paramteres: In_Drive_Label Out_Drive_Label [EXEC/NOEXEC] [Compression_Level]")
goto exit
end if
a1=arg(1)
a2=arg(2)
if left(a1,1) = "^"" THEN
a1=MID(a1,2,LEN(a1)-2)
end if
if left(a2,1) = "^"" THEN
a2=MID(a2,2,LEN(a2)-2)
end if
getdrvltrinfo()
n=0
h=gethdinfo(n)
while h
pn=1
while h.partition[pn]
printl("HDNum:", h.num,"-",pn,"-",0," name:", pad(h.partition[pn].name,16)," id:", hex(h.partition[pn].id))
if a1 = h.partition[pn].name THEN
fpxx=hex(h.partition[pn].id)
fdxx=h.num
end if
if a2 = h.partition[pn].name THEN
tpxx=hex(h.partition[pn].id)
tdxx=h.num
end if
vn=1
while h.partition[pn].volume[vn]
printl("HDNum:", h.num,"-",pn,"-",vn," name:", pad(h.partition[pn].volume[vn].name,16)," id:", hex(h.partition[pn].volume[vn].id))
if a1 = h.partition[pn].volume[vn].name then
fpxx = hex(h.partition[pn].volume[vn].id)
fdxx=h.num
end if
if a2 = h.partition[pn].volume[vn].name then
tpxx = hex(h.partition[pn].volume[vn].id)
tdxx=h.num
end if
vn=vn+1
wend
pn=pn+1
wend
printl(" ")
printl(" ")
n=n+1
h=gethdinfo(n)
wend
printl ("From Drive: ",arg(1)," ID: ",fpxx," To Drive: ",arg(2)," ID: ",tpxx)
if fpxx = "UNKNOWN" then
goto exit
end if
if tpxx = "UNKNOWN" then
goto exit
end if
if arg(4)<>"" then
comp=arg(4)
end if

if TBSENV = "DOS" then
string2="IMAGE.EXE /b /uy /d:d"#fdxx#"@0x"#fpxx#" /f:d"#tdxx#"@0x"#tpxx#":^"\$~YYYY$-$~MM$-$~DD$-$~HHMM$-"#arg(1)#"-^" /max:4GiB /v /comp:"#comp#" /logfile:c:\ifd.log"
elseif TBSENV = "LINUX" then
string2="imagel --b --uy --d:l"#fdxx#"@0x"#fpxx#" --f:l"#tdxx#"@0x"#tpxx#":^"/$~YYYY$-$~MM$-$~DD$-$~HHMM$-"#arg(1)#"-^" --max:4GiB --v --comp:"#comp#" --logfile:ilf.log"
end if

printl ("")
printl (string2)
printl("")
if arg(3)="EXEC" then

logfile=open("IFD.LOG","in-out")
seek(logfile,lof(logfile))
writel (logfile,"=================================")
writel (logfile,string2)
writel (logfile,"= = = = = = = = = = = = = = = = =")
close(logfile)
exec (string2,1)
end if
exit:
getdrvltrinfo(0)
end sub
Last edited by tas3086 on Sat Feb 16, 2013 7:01 pm, edited 4 times in total.
TeraByte Support
Posts: 3598
Joined: Thu May 05, 2011 10:37 pm

Re: IFD Script that uses partition names for backup

Post by TeraByte Support »

thanks for the script.

"tas3086" wrote in message news:4379@public.scripting...

Attention IFD Users:
Do you have problems with using the IMAGE.EXE /b /uy /d:d0@0x1 /f:d2@0x2E4:"
..... file and partition selection nomenclature?
If so, give this little script a try. It converts MBR and EMBR partition
names into these disk and partition numbers that image.exe needs.
This is especially useful if you have USB drives, or plug and play sata
drives installed, or if you move disks and or partitions around ... as the
numbers change on each movement.

Heres the format of the (tbos) command:
IFDIMG2.TBS In_Drive_Label Out_Drive_Label [EXEC/NOEXEC]
[Compression_Level]

Required parameters:
in_drive_label : the case sensitive MBR or EMBR partition name to
be backed up (put in quotes for multi word names)
out_drive_label: specifies a case sensitive output partition name
for the backup file. (file name is hardcoded in script)
optional parameters:
EXEC : Image command will be displayed and then run
NOEXEC: Default, the command to run image.exe will be displayed but
will not be executed.
Compression_Level: defaults to 1. You can specify any supported compression
level
-----------------------------------------------------------------------------------------------------------------------
I use this script to backup my key partitions. It calls the IFD2MG2.TBS
script. I run it from my BOOTITBM selection menu.
Depending on what and where I have my disks installed, it finds them and
backs them up. If they are not available, the script just continues to the
next drive. Good luck, change as necessary for your system. As always
there are no guarantees that this will work on your system, but it can
probably be easily fixed !
-------------------------------------------
BU.TBS:
sub main()
EXEC ("IFDIMG2.TBS LEXAR64MB I_DRIVE EXEC 2",1)
EXEC ("IFDIMG2.TBS LinuxMint I_DRIVE EXEC 2",1)
EXEC ("IFDIMG2.TBS CNEW52P1 I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS Win7(64) I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS Win7(32) I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS D_DRIVE I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS E_DRIVE I_DRIVE EXEC 1",1)
EXEC ("IFDIMG2.TBS F_DRIVE I_DRIVE EXEC 1",1)
end sub
--------------------------------------------------------------------

Humm ....... The forum will not let me post the IFDIMG2.TBS script ... let
me see what is going wrong. I'll be back

tas3086
Posts: 317
Joined: Mon Mar 19, 2012 6:15 pm

Re: IFD Script that uses partition names for backup

Post by tas3086 »

Adding a feature to IFD that allows the use of MBR/EMBR partiton names would make things a lot easier for backups on ever changing systems. It would also me nice to have a way to locate the log file with the same nomenclature.
Post Reply