China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-30 05:09
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Disk sector reading and writing, partition information management tool Dsptw (updated on 2008.11.29) View 112,548 Replies 565
Floor 31 Posted 2006-12-17 12:20 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 295
Posts 70
Joined 2003-07-24 00:00
22-year member
UID 7462
Gender Male
Status Offline
Is there no function to display the volume label? And which version corresponds to GHOST?
Floor 32 Posted 2006-12-18 21:47 ·  中国 北京 华北计算技术研究所
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by cba-xyz at 2006-12-17 12:20:
Is there no function to display the volume label? And which version corresponds to GHOST?


Due to time constraints, the function to display the volume label has not been implemented for the time being. In the GHOST version, the partition does not include the total extended partition, that is, the 1:1, 1:2, etc. only include primary and logic partitions.

I have mastered the method of reading the volume label, and I will add it in future versions. However, this will make the program larger and larger, which is not what I want.

My earliest version also did not include the total extended partition. Later, a netizen proposed that the total extended partition should be added, and it was added in subsequent versions.

Different people have different requirements, which also brings me a certain difficulty. If everyone can give a standard, it will be easier for me to program here.
Floor 33 Posted 2006-12-18 22:16 ·  中国 北京 华北计算技术研究所
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by cchessbd at 2006-12-8 07:59:
Perhaps you can also add a function, referring to the backup and restore of Red Dragonfly (EditTool 1.0).
/SDE|RDE|CDE respectively mean backup to the last sector, restore from the last sector, and compare with the last sector backup.
Here...


The function you need has been added. The program no longer needs to be renamed to implement the function, and the function is identified through parameters.
The program is renamed to "dspt.com", which means Disk Sector & Partition Tools

Syntax:
DSPT
Disk: 0-First Hard Disk, 1-Second Hard Disk, ...
A:, B:
Start: Disk Absolute Sector Number
:n n - Partition Number
Sectors: Total Sectors to be Processed
/S: Save Disk Sector Info to File
/R: Restore Disk Sector Info from File
/C: Compare Disk Sector Info with File
FileName: Disk Sector Info File
/Y: Assume Yes on all Queries

DSPT
/L: List Disk Sector Info on Screen
/P: Pause echo Screen
/A: Show ASC Value
DSPT
/E: Clear Disk Sector Info

DSPT
Disk: 0-First Hard disk, 1-Second Hard Disk, ...
/S: Save Disk Partition Info to File.
/R: Restore Disk Partiton Info from File.
/C: Compare Disk Partiton Info with File.
FileName: Disk Partition Info File.
/Y: Assume Yes on all Queries

DSPT
Save Partition Boot Record to File.
DSPT
List Disk Partition Info on Screen.
DSPT
Active Disk Partition n.
DSPT
Find Disk Partition.
type: Can be FAT16/FAT32/FAT/NTFS/LINUX/ALL.
DSPT
ReBuild Disk Main Boot Record.
/NOBACK: Don't Backup old MBR.
DSPT
Hide/Unhide Disk Partition n.

DSPT
Disk: 0-First Hard disk, 1-Second Hard Disk, ...
/DPS: Save Disk Partition Info to Last Sectors.
/DPR: Restore Disk Partiton Info from Last Sectors.
/DPC: Compare Disk Partiton Info with Last Sectors.
/Y: Assume Yes on all Queries

Newly added functions:
DSPT
/E: Clear Disk Sector Info
This function is to clear the disk sector information.
The /Y parameter means no confirmation is needed, that is, it is defaulted to YES

DSPT
Disk: 0-First Hard disk, 1-Second Hard Disk, ...
/DPS: Save Disk Partition Info to Last Sectors.
/DPR: Restore Disk Partiton Info from Last Sectors.
/DPC: Compare Disk Partiton Info with Last Sectors.
/Y: Assume Yes on all Queries
This function is to save the partition table to the last few sectors of the disk;
restore the partition table from the last few sectors of the disk;
compare the partition table information with the information saved in the last few sectors of the disk.

Warning: When using the DSPT function, it is required that you confirm that your computer motherboard supports large hard disks, otherwise the hard disk capacity obtained through the bios may not be the true capacity of the hard disk, resulting in the last sector of the obtained hard disk not being the true last sector of the hard disk. This function may cause data loss when executed. Please use this function with caution. I am currently considering whether to provide this function. This is just a test version with a time limit (December 31, 2006). Maybe I will remove this function in future versions.

[ Last edited by 19951001 on 2006-12-22 at 05:54 AM ]
Floor 34 Posted 2006-12-19 03:15 ·  中国 浙江 温州 乐清市 电信
新手上路
Credits 4
Posts 2
Joined 2006-12-18 23:57
19-year member
UID 73890
Gender Male
Status Offline
Follow this post, thank you to the LZ for providing such a good tool
Floor 35 Posted 2006-12-19 04:20 ·  中国 四川 成都 电信
初级用户
Credits 66
Posts 24
Joined 2006-12-14 01:18
19-year member
UID 73443
Gender Male
Status Offline
Good tool, support it
Floor 36 Posted 2006-12-19 04:31 ·  中国 北京 华北计算技术研究所
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
If the test version on floor 34 has no issues, I will provide a version without time restrictions by New Year's Day.
Floor 37 Posted 2006-12-19 09:29 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 295
Posts 70
Joined 2003-07-24 00:00
22-year member
UID 7462
Gender Male
Status Offline
The functions are more, and the program will get larger. But of course, if it has nothing to do with the program, it can be removed. Please add the function to modify the partition flag if possible. I don't want the earliest ones anymore. I hope to use the latest ones.
It is suggested that for the display of the total extended partition and not displaying, either add a parameter, which can be improved a bit.

[ Last edited by cba-xyz on 2006-12-19 at 09:36 AM ]
Floor 38 Posted 2006-12-19 09:32 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 295
Posts 70
Joined 2003-07-24 00:00
22-year member
UID 7462
Gender Male
Status Offline
If the LZ has time to write a software for creating and managing HPA partitions under DOS, many people would probably want it. If interested, heh.
Floor 39 Posted 2006-12-20 00:26 ·  中国 北京 华北计算技术研究所
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by cba-xyz at 2006-12-19 09:29:
The more functions there are, the larger the program will be. However, if it has nothing to do with the program, it can definitely be removed. If possible, please add the function to modify the partition flag. I don't want the earliest version anymore. I hope to use the latest one....


The function to modify the partition flag has been implemented, which is the function to hide/show partitions.
dspt 0 /hide:3
dspt 0 /unhide:3

It is feasible to add a parameter to control whether to display.
Floor 40 Posted 2006-12-20 00:29 ·  中国 北京 华北计算技术研究所
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by cba-xyz at 2006-12-19 09:32:
If the thread starter has time, writing a software to create and manage HPA partitions under DOS should be something many people want. If interested, heh.


Regarding HPA, I don't have relevant information at present. If any friend has it, please provide it. I think the specific programming implementation should be feasible.
Floor 41 Posted 2006-12-20 07:57 ·  中国 浙江 温州 文成县 电信
新手上路
Credits 4
Posts 2
Joined 2006-12-18 23:57
19-year member
UID 73890
Gender Male
Status Offline
Can the program posted by the LZ on floor 34 not be used in the command line under NT?

I made some edits. There is also a question that I'm relatively new to, I'll study it by myself first heh heh

[ Last edited by yqayan on 2006-12-19 at 08:55 PM ]
Floor 42 Posted 2006-12-20 10:49 ·  中国 浙江 宁波 电信
中级用户
★★
Credits 295
Posts 70
Joined 2003-07-24 00:00
22-year member
UID 7462
Gender Male
Status Offline
Currently, there is no detailed information about HPA.

I. What is HPA
Hidden protected area or Host protected area

HPA is an area defined in ATA/ATAPI-4, which is after the BIOS-visible space, so it cannot be accessed through the BIOS. But it can be accessed by directly sending AT commands.
The popular understanding is to set the maximum sector number of the read hard disk, so as to hide the high-end content. This maximum sector number can be written in a certain place on the hard disk. Therefore, even if you hang this hard disk on other machines, normally you cannot see the hidden content, and tools like Fdisk, PowerQuest PartitionMagic also treat this hard disk as a hard disk with a slightly smaller capacity. Now HPA has been based on the ATA-5 standard, and this standard needs to be supported by the HDD's Firmware.
Examples of using HPA are Phoenix's Core Managed Environment (cME), IBM's Access IBM, and Lenovo motherboard's recovery easy II.

II. Introduction to recovery systems using HPA technology currently
(1) System integrators
1. IBM's Access IBM
For models launched after 2003, IBM uses the new HPA technology to replace the previous partition-based product recovery solutions (Partition-based recovery solutions).
During the boot process, HPA interrupts the boot process by pressing the Enter key or the Access Thinkpad key and activates a program called Access IBM Predesktop Menu, which can provide functions such as diagnosing the system, restoring the operating system, and upgrading/restoring the BIOS. The original D2D system activates the Service Partition by pressing F11 during the boot process and performs operating system restoration. The HPA technology can integrate the Rapid Restore PC function, and can back up user data in the HPA partition.
There is relatively more research on IBM's one-key recovery system on the Internet, and you can find relevant resources later.

2. Lenovo's one-key recovery 4.5 and leos system (data last updated on May 19, 2005)
There are relatively few materials on Lenovo's one-key recovery system, and the official only gives a simple introduction. You can download the leos installation CD to analyze.
3. Founder's emergency recovery system
There are very few relevant materials on Founder's emergency recovery system. No materials were found on the official homepage. I only downloaded the manufacturer's deployment emergency center tool CD, but it was not installed successfully.
(2) Third-party manufacturers
1. Phoenix's Phoenix FirstWare Recover Pro
2. Super Future Information Co., Ltd.'s PCClone v1.64

III. Design ideas for DIY one-key recovery system

Why DIY?
Other software is bloated, difficult to port, not fast enough, etc.

1. Design requirements: Through our manual transformation, it is required to achieve easy installation, stable use, simplicity. The one-key recovery system must be robust and not easy to damage, etc.
2. Design ideas: Use HPAtool to create one (it is not yet certain the exact number, one or two, or more) HPA partition, modify the MBR code, so that during the boot process, press a certain hotkey to start its own loaded backup software (considering speed, etc., use Ghost 8.3) from the HPA area to perform backup and restore operations.
3. Existing problems:
(1) Creation of HPA partition
Lenovo provides a tool, HPAtool, and the updated version on April 20, 2005 is v0.8D.
Briefly introduce the use of this tool when creating an HPA partition:
HPATOOL
Among them, the space will be divided from the highest sector down in the order of TypeID; HDDx is the target hard disk number.
Regarding this TypeID field, I still don't understand it. By checking the installation files jiayue.bat in the leos installation CD home Yue D model, TJA.bat in the Tianjiao A-X model, and TJE.bat in the Tianjiao E-X model, I found
First, they all create multiple partitions, and then add modules to corresponding partitions.
Second, the meaning of their TypeID field cannot be understood.
Why create multiple HPA partitions? Could there be a partition similar to a "primary partition" in multiple partitions to realize the boot function? After checking the relevant materials on IBM HPA, I found that there is indeed a part similar to the hard disk MBR in the HPA partition, which records relevant content of each HPA partition, just like the partition table. But in the "part similar to the hard disk MBR", are the "bootable code" part and the "first 80 partition" created by the partition software? Or added later? If added later, what does a specific data bit represent? Lenovo has made it into a bin module and added it in.

(2) How to access and manage HPA partition
If it is a system integrator, such as IBM, lenovo, then it is almost not a problem, and the original program can be used. But for our DIY, we must consider it.
Since int 13 cannot access the HPA partition, how to boot from this partition and run Ghost? Founder provides a tool, UlockHPA, which runs in the DOS environment and can open the HPA partition for operation. This is just a direction. If thinking along this direction, then: Where does the DOS environment required to run this tool come from? Do we need to create a primary partition to install DOS? Can we add code in the MBR or in the next few sectors (first 63 sectors) to realize the corresponding functions? If this is possible, that would be the best. When the hotkey is pressed, the HPA partition is automatically opened, and when the backup software operation is completed, the partition is automatically closed (this may require the support of other scripts in this partition).

(3) When the MBR is damaged, can the MBR be quickly restored manually? Can we boot from the CD-ROM and extract the image file from the HPA partition for restoration?
(4) How to quickly and conveniently install the one-key recovery system (this is a later topic, let's not discuss it for now)

IV. Additional resources
Access IBM technical support page
http://www-3.ibm.com/pc/support/ ... S.html#APPLYCOUNTRY

Super Future Information Co., Ltd.'s PCClone v1.64
http://www.gotofnet.com/Big5/lin ... s/PCClone/index.htm

PCClone hard disk specification test program (this tool mainly detects whether your hard disk supports HPA)
http://www.gotofnet.com/Big5/lin ... d/utility/index.htm

Lenovo Yangtian one-key recovery 4.0 hidden partition structure
http://faq.lenovo.com.cn:81/docs ... Er77zN1z8dbHoI.html

Lenovo home computer new version (v3.0) one-key recovery software instruction manual
http://faq.lenovo.com.cn:81/docs ... pa44HJdBCMCctR.html

LEOS system CD
http://www.znpc.net/bbs/viewthre ... &extra=page%3D1

Back up the hidden system partition of IBM notebooks
http://article.pchome.net/00/01/13/06/index.phtml?40,0


Practice is higher than theory, and there are innovations in practice.

A few more words:
1. Virtual machines do not support HPA partitions.
2. Please experiment on unimportant hard disks.
3. Access IBM HPA header standard document ANSI+NCITS+346-2001.
Related link address: http://webstore.ansi.org/ansidoc ... NSI+INCITS+346-2001
Unfortunately, it costs $30. If anyone has this standard document, please share it for joint research.
4. It may be more labor-saving to study with IBM as the prototype. There are still some discussions about IBM on the Internet, although there are many repetitions. The ThinkPad system recovery CD may be useful to you.

Precautions: The above discussion of mine refers to some articles on the Benyouhui forum, Sysoft Time and Space forum, and other websites. Thanks for that.
I have only initially studied the HPA technology. If there are any improper places in the above discussion, please feel free to give advice. This article can be freely reprinted, but please keep the file original, indicate the source, and keep the precautions. Thank you.


Updated again on 200608022028:

It seems necessary to introduce some basic knowledge

ATA/ATAPI-4 revision 18 (final draft)
http://t13.org/project/d1153r18-ATA-ATAPI-4.pdf

ATA/ATAPI-5 revision 3 (final draft)
http://t13.org/project/d1321r3-ATA-ATAPI-5.pdf
Of course, there are other materials such as ATA/ATAPI-6, ATA/ATAPI-7, ATA/ATAPI-8, etc. Those who need can download from http://www.t13.org/.

You can go to DOSTOR.com Storage Online to see white papers and posts. Related link: http://www.dostor.com/

http://bbs.wuyou.com/viewthread.php?tid=80412&highlight=hpa
Floor 43 Posted 2006-12-22 05:41 ·  中国 北京 中移铁通
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by cba-xyz at 2006-12-20 10:49:
There is currently no detailed information on HPA

I. What is HPA
Hidden protected area or Host protected area

HPA is an area defined in ATA/ATAPI-4, located after the BIOS visible space, so accessing through BIOS ...


Thanks for providing. I will study these materials carefully when I have time.
Floor 44 Posted 2006-12-22 05:47 ·  中国 北京 中移铁通
高级用户
★★
流落街头
Credits 570
Posts 272
Joined 2005-10-17 10:51
20-year member
UID 43609
Gender Male
From 北京
Status Offline
Originally posted by yqayan at 2006-12-20 07:57:
Can the program posted by the owner on floor 34 not be used in the command line of NT?

I edited it, and there is another question that I am relatively noobish, I will study it by myself first heh heh

[ Last edited by yqayan on 2006-12-19 at 08:55 PM ...


The program on floor 34 is a DOS program, it cannot run under NT. After testing it is normal, I will provide the WIN32 version.

There is a BUG in the new function of the program on floor 34, and the second test version (without disk sector reading and writing) is provided.
Support whether to display the total extended partition, the default is to display, if the parameter /NoExt is added, it will not be displayed,
Please help test this version if your disk is partitioned like this.
1. The first partition entry in the MBR is an extended partition, and then the primary partition;
2. The first partition entry in the MBR is a primary partition, the second partition entry is an extended partition, and then the primary partition;

[ Last edited by 19951001 on 2006-12-26 at 11:24 PM ]
Floor 45 Posted 2006-12-23 05:38 ·  中国 四川 成都 电信
初级用户
Credits 66
Posts 24
Joined 2006-12-14 01:18
19-year member
UID 73443
Gender Male
Status Offline
Very good tool. I used it last night, and it worked very well.

I hope it can display partition drive letters like FDISK and change disk parameters (0, 1, 2) to start from 1 and be the same as GHOST's display method, just a suggestion.

By the way, is the version on the upper floor (45th floor) a time-limited version? I want to integrate it into the startup of my new CD...
Forum Jump: