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-08-15 11:34
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Discussion] How to accurately determine the location of the system disk in pure DOS View 2,496 Replies 12
Original Poster Posted 2010-10-08 09:23 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
In a multi-hard drive environment with multiple active partitions, and given each partition and drive letter, etc. What method can be used under pure DOS to determine the location of the system drive to be backed up? I thought of a method which is to judge through files exclusive to XP or Win7, I don't know how accurate it is, and I want to listen to everyone's ideas.
Floor 2 Posted 2010-10-09 23:06 ·  中国 山西 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
In this case, it is suggested not to make any intelligent judgments. Letting users make their own choices is the best approach. Because intelligent selection is aimed at novice users, and such users are extremely unlikely to encounter the above - mentioned complex situations. And for advanced users using the above - mentioned environments, usually there is no need to arbitrarily make decisions for the other party, because the other party may have their own unique needs, such as data area or multi - partition backup. Moreover, the partition situation can be very simple or very complex. Various complex situations such as multiple hard disks, multiple active partitions, multiple file systems, multiple systems, cross - partition systems and so on are hard to list exhaustively.
Floor 3 Posted 2010-10-10 09:20 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
It is indeed the case, and it feels quite complicated.

Thanks!

If using a unique file or directory to judge should be much more accurate than the general Windows form, right?

[ Last edited by bugs on 2010-10-10 at 09:22 ]
Floor 4 Posted 2010-10-10 09:55 ·  中国 上海 浦东新区 电信
金牌会员
★★★★
Credits 3,467
Posts 1,616
Joined 2004-06-21 00:00
22-year member
UID 27148
Status Offline
First, create a temporary identification file or folder in the system drive under Windows. Then restart and enter DOS, and after operation, delete this identification file.
Floor 5 Posted 2010-10-12 23:54 ·  中国 山西 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
My suggestion is still not to consider multiple hard drives or multiple partitions. Just smartly point the target to the first partition of the first hard drive. After all, this is the situation for over 90% of users. And for the other 10% of users, leaving a manual option is enough. You should know that generally, the more intelligent a program is, the more complex it usually is, which means it is more prone to bugs. You will often find that after you spend 90% of your energy solving 10% of the problems, the size of your code increases by ten times or more. This means that the probability of new problems increases by 100 times or more. The balance between giving up and getting needs to be carefully considered.
Floor 6 Posted 2010-10-13 14:49 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
Thanks for the reply!
What are the possible errors in the judgment if a unique file exists in the system disk?
Floor 7 Posted 2010-10-13 16:06 ·  中国 北京 门头沟区 光环新网联通数据中心
银牌会员
★★★
Credits 1,455
Posts 712
Joined 2006-01-20 10:26
20-year member
UID 49246
Status Offline
Originally posted by qzwqzw at 2010-10-12 23:54:
My suggestion is still not to consider multiple hard drives or multiple partitions.
Intelligently select by simply pointing the target to the first partition of the first hard drive.
After all, this is the situation for more than 90% of users.
And for the other 10% of users, leave...

Hehe, seriously agree!
Floor 8 Posted 2010-10-13 20:38 ·  中国 山西 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Originally posted by bugs at 2010-10-13 14:49:
Thanks for the reply!
If there is a unique file set on the system disk, what are the possible errors in the judgment?

Really persistent

"If there is a unique file set on the system disk"
Since you already know the system disk, why do you need to judge the system disk
Isn't this a logical paradox?

I know what you mean is
Mark files in Windows
Read file marks in DOS

But I want to ask how you confirm the system disk in Windows?
Environment variables, WMIC, system files or other advanced technologies?
You know that all these technologies cannot solve the problem of multiple systems
Especially the problem of cross-platform multiple systems

You are booted into the Windows system of partition X
Can you be sure that partition Y is not a system partition
So no need to back up?

If you can't confirm the system disk in Windows
How to make the program under DOS recognize the mark?

Moreover, using files as partition marks
Actually, it is a very unwise behavior
Because in program design
We have to mix partition operations with file operations
And we know that they are actually two levels of things
In the correspondence between these two levels of relationships
Even professional software may not do it well
Let alone self-written code
Is the partition number so simple to the drive letter?

[ Last edited by qzwqzw on 2010-10-13 at 20:44 ]
Floor 9 Posted 2010-10-13 22:33 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
I assume an environment.
There are 3 hard disks, each hard disk has 2 partitions, and the corresponding relationships are as follows:
1-1 C xp
1-2 D win2003
2-1 E
2-2 F
3-1 G win7
3-2 H

If you want to back up the win2003 system, boot into the system, and know that the corresponding partition is drive D of 1-2, then I generate a mark file in drive D, and then detect the mark file in DOS. Detecting it means it is the system that needs to be backed up. Is there any problem with this judgment?

I didn't understand where the problem is. Please give me some pointers, thank you!
Floor 10 Posted 2010-10-14 22:09 ·  中国 山西 运城 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Then what you mean is that the user needs to decide which system to back up, first boot into the corresponding system, then run your software to restart to DOS for backup, instead of backing up the partition of another system under one system.

In this way, it seems that you are not going to consider users of Linux systems, but simply want to make a program similar to one-click backup and restore under Windows.

This process actually involves 3 processes: writing a marker file to the partition of the current system you think, restarting to a DOS Shell, reading the marker files of all drive letters in order under DOS, and finally backing up and restoring the system according to the drive letters.

First, look at process 1. If the system boot program is in the first partition and the system main folder is in the second partition, which partition do you think should be backed up?

If the system unfortunately uses dynamic disks, then except for simple volumes, spanned volumes, striped volumes, and RAID-5 volumes will merge multiple disk spaces into one volume. Which partition do you think should be backed up?

If the system uses the NTFS file system and uses MountPoint to mount other data partitions as a directory of the system volume, is there a possibility that your file marker is exactly written to this MountPoint directory?

If a PE system is booted and the system volume is on a memory virtual disk, how should the backup be done after restarting?

If it is a diskless workstation Windows, how should the backup be done?

What if it is a Windows system with a shadow system or a restore card?

Then look at process 2. Restarting to boot into DOS seems simple. It only needs to write a boot entry to boot.ini under the system volume and then use the way of grldr or bootsect.dos to start. The problem is that the boot partition must specify the drive letter or partition number of the boot partition, and it is as confused as the problem in process 1.

Finally, look at process 3. After entering DOS, read the marker file. If there is an NTFS partition on the hard disk, the NTFS driver must be mounted. And basically, no matter what driver it is, it is after the CD-ROM driver, and the USB boot device that may be inserted will also be loaded, which makes the drive letter order under DOS very different from the physical partition order, and the CD-ROM drive letter may be confused among them. If there is no CD in the CD-ROM, then when traversing all drive letters to read the file, reading the CD-ROM without a CD will definitely report an error, and a lot of code is needed for error handling, and then continuous debugging...
Floor 11 Posted 2010-10-14 22:25 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
Process 1:
1. Taking XP as an example, the system is started by ntldr reading the boot.ini file. I don't know how to separate the boot file ntldr from the Windows main directory. Please tell me your method so that I can test it.

2. As for what you said that it is very unfortunate to use a dynamic disk system. This point is not valid. Because dynamic disks will prompt that they cannot be recognized during the installation process in XP and 2003, and the system will not be installed. I don't know if it is the same under Win7. I will do a test when I have time later.

3. Using MountPoint to mount other data partitions as a directory of the system volume. This method is the first time I have heard of it. If the identification file is in the root directory of the system disk, this should not be a problem.

4. I don't know how many people usually use the computer in the PE environment, so I really didn't think about this aspect. I still need to think more.

5. I think there is no need to back up the system for a diskless system.

6. I have never used Shadow System and don't know much about it. I will also install and test it when I have time. But I have come into contact with both hard restoration and soft restoration for systems with restoration. I really can't figure out the difference between them and the normal system when the restoration is not protected. Even if the system recovery is done with the restoration enabled, except that IcePoint needs to do some processing, other restoration systems will run normally. (The restoration system software I have come into contact with is relatively few, only IcePoint, NetWin, EasyNet, Xunsan, etc.)

Process 2, 3
Can I understand that it is the problem of identifying the hard disk partition number and drive letter under DOS?
If that's the case, there should be no problem.

[ Last edited by bugs on 2010-10-15 at 18:47 ]
Floor 12 Posted 2010-10-16 18:36 ·  德国 巴伐利亚州 纽伦堡
金牌会员
★★★★
Credits 3,467
Posts 1,616
Joined 2004-06-21 00:00
22-year member
UID 27148
Status Offline
1. Choose to install the system to a non-activated primary partition, and ntldr and the windows folder will be in different partitions.
2. You can convert to a dynamic disk after installing the system.
3. Theoretically, you can mount the boot partition in a folder without assigning a drive letter. I used to do this for a period, mounting the partition where ntldr is located to the c:盤 boot folder.
Floor 13 Posted 2010-10-21 07:19 ·  中国 湖北 武汉 电信
新手上路
Credits 18
Posts 13
Joined 2010-08-30 17:27
15-year member
UID 173270
Gender Male
Status Offline
1. Separation of system boot files and system directories
In the environment simulated by the virtual machine:
1-1 Active primary partition
1-2 Primary partition
1-3 Extended partition

For the WinXP system: There are ntldr, boot.ini, bootfon.bin, ntdetect.com, msdos.sys, io.sys under 1-1, and other files and directories are under 1-2.
For the Win7 system: There is a boot directory and bootmgr under 1-1, and other files and directories are under 1-2.

That is to say, if this kind of use environment is detected, only the corresponding files need to be processed.
If you don't care about the size of the backup file, you can back up 1-1 and 1-2 together, but I don't think it is necessary.

2. Dynamic disks
First, talk about spanned volumes, striped volumes, etc...
If other types besides simple volumes are adopted, Ghost cannot recognize them and cannot be backed up. So I think there is no need to deal with this type.

Then talk about simple volumes.
I am using ifs now, which supports ntfs/ext2/ext3 and hidden partitions, but does not support dynamic disks - -!
ntfs4dos supports dynamic disks, but others do not.
To choose between simple volumes and ext2/ext3, hidden partitions, I choose the latter.
If you have a better way to recognize various partition types at the same time, you can tell me, thank you!

3. The boot partition is mounted in a folder without assigning a drive letter
I didn't find any software or method to simulate this environment, please tell me, thank you!
Forum Jump: