Поддерживает ли NTFS (или любая файловая система) файлы за пределами раздела?

466
Cole Johnson

На моем диске C: был файл BOOTSECT.BAK . Не зная, что это такое, я открыл его в формате HxD, и первые 14 байтов B \0 O \0 O \0 T \0 M \0 G \0 R \0соответствовали строке UTF-16LE BOOTMGR. После некоторых исследований я обнаружил, что это VBR для Windows. Это установлено в секторе 63 (или 2048 на Vista +).

После дополнительных исследований, это оказывается копия VBR, а не фактическая вещь. Это смутило меня, так как я почти уверен, что где-то слышал, что Windows предоставляет свой собственный файл где-то в C:\Windows\System32или C:\Windows\boot. Я также слышал, что Windows назначает MBR файл в одном из этих каталогов.

TL; DR: может ли NTFS (или любая другая файловая система) назначить файл за пределами раздела? Скорее всего, с отрицательными целыми числами или LBA начального сектора (т.е. -2048 для смещения сектора или 2048 для LBA)

5

3 ответа на вопрос

6
Breakthrough

Can NTFS (or any other file system for that matter) assign a file outside of the partition?

No, wouldn't that completely void the purpose of a filesystem to begin with? If you just want to manipulate the raw 0's and 1's stored on the disk outside your partition, there's plenty of low-level disk operation tools you can use. You can also mount another partition within a mounted NTFS partition (i.e. you can mount another partition at C:\MyNewVol\), if the files are stored within another filesystem.

Those particular files you outlined above are called metafiles, and are well defined per the NTFS specification. See that previous link for a description of various metafiles (e.g. the VBR you mentioned is stored in the $Boot metafile), and where they are located on-disk with respect to the NTFS partition boundaries.

Also, with respect to the whole MBR vs. VBR, from the Wikipedia page on VBR:

[The VBR] is the first sector of an individual partition on the device, with the first sector of the entire device being a master boot record (MBR) containing the partition table.

Thus, you can access the VBR through the NTFS filesystem (assuming you have the proper permissions to do so), but you can't directly access the MBR; for that, you do need low-level disk tools.

4
jlliagre
Does NTFS (or any file system) support files outside of the partition? 

Not that much on Windows but on Unix variants, and depending on how you define what a file is, you'll find file systems supporting files outside the partition.

  • tmpfs support files stored partially or totally in RAM.
  • procfs contains files in /proc/pid/fd/ that definitely belong to other file systems
  • in /dev (or /devices) you have "files" which content is outside the partition. You can access the VBRs and MBRs through them (eg: /dev/sda1, /dev/dsk/c0d0t0p1, ...).
  • All file systems supporting symbolic links can also sort of store files from foreign locations.

It looks like installing cygwin will provide a /dev directory from which you would be able to access full disk and partition raw data including the VBRs and MBRs.

Тем не менее, эти каталоги являются просто точками монтирования в другой файловой системе, как я упоминал ранее. Доступ к файлам и подкаталогам в этих точках монтирования полностью обходит файловую систему на один уровень выше (т.е. я монтирую свою основную EXT4 FS в `/`, и монтирую свой RAMDISK в `/ tmp`, файлы в` / tmp` ничего не имеют делать с EXT4 FS, только RAMDISK один). Это то же самое, что и точки монтирования в Windows. Breakthrough 11 лет назад 0
@Breakthrough tmpfs, procfs и символические ссылки были только примерами. Реальный ответ - / dev. Его записи не на всех точках монтирования. Это файлы специального вида (символьные и блочные устройства), содержащие данные вне текущей файловой системы, и один из них начинается с BOOTMGR в кодировке UTF-16LE в случае Коула. jlliagre 11 лет назад 0
1
Hennes

Filesystems only address data inside their own allocated space.

However an operating system has no such limitations and it can stores information read from anywhere on the disk in a file.

The distinction between the OS and the FS might be small, but it is vital.