하드 링크 백업 및 복원
하드 링크를 백업하고 복원하려면 다음 의사 코드 예제와 같이 CreateFile, CreateHardLink, FindFirstFileNameW, FindNextFileNameW, BackupRead, GetFileInformationByHandle 및 BackupWrite 함수를 사용합니다.
하드 링크 백업을 위한 의사 코드 알고리즘
1. Initialize and empty a list of known links.
2. While there are more files to back up
3. Read the disk and get the next file.
4. Call CreateFile to open the file for read.
5. Call GetFileInformationByHandle to get the NumberOfLinks
and the FileIndex.
6. If the NumberOfLinks is greater than 1
7. Search the list of known links, looking for the
same FileIndex.
8. If a match is found
9. Skip this file; its link exists already on
your backup media.
10. Else
11. Add the full path of the file and the FileIndex
to the list of links.
12. Call BackupRead to copy all data to your backup media.
13. Call FindFirstFileNameW and FindNextFileNameW to
enumerate the hard links to the file.
14. For each hard link
15. Mark the data as a LINK on your backup media.
16. Store the full path from the list to your backup media.
17. Endfor
18. Endif
19. Else
20. Call BackupRead to copy all data to your backup media.
21. Endif
22. EndWhile
하드 링크 복원을 위한 의사 코드 알고리즘
1. While there are more files to restore
2. If there are hard links to the file
3. Call CreateHardLink to recreate the links.
4. Endif
5. Call BackupWrite with the data stored on your backup media
6. EndWhile
Windows Server 2003 및 Windows XP:FindFirstFileNameW 및 FindNextFileNameW 함수는 지원되지 않습니다. 대신 다음 의사 코드 예제에 설명된 절차를 사용할 수 있습니다.
하드 링크 백업을 위한 대체 의사 코드 알고리즘
1. Initialize and empty a list of known links.
2. While there are more files to back up
3. Read the disk and get the next file.
4. Call CreateFile to open the file for read.
5. Call GetFileInformationByHandle to get the NumberOfLinks and
the FileIndex.
6. If the NumberOfLinks is greater than 1
7. Search the list of known links looking for
the same FileIndex.
8. If a match is NOT found
9. Add the full path of the file and the FileIndex
to the list.
10. Call BackupRead to copy all data to
your backup media.
11. Else
12. Mark the data as a LINK on your backup media
13. Store the full path from the list
to your backup media.
14. Endif
15. Else
16. Call BackupRead to copy all data to your
backup media.
17. Endif
18. EndWhile