开发者

How does file sysem information get stored in memory?

Computers recognize different file systems. My question is, where exactly does this information get stored in a memory device (the specific location if any). Or does it not get stored anywhere & rather an operating system tests the system (memory device) against a known set of file systems (like ext3, ntfs, etc) ?

With reference to the above, If I copy every bit (first to the last) from a memory device to another one, of the same memory size (say two similar flash drives) will the later one be a total clone? Will the cloned device automatically inherit the f开发者_C百科ile system?

If the clone cannot be obtained by bit-by-bit copying what else is required?

I believe this question is supposed to be somewhere else in SE, but I'm not sure of that place.


EDIT : I am working with a 8085 microprocessor here, so not really looking for softwares on cloning.


Every time a new block device shows up, the operating system generally tests a bunch of filesystem drivers against it, and when one of them matches, starts it up and hooks it up to whatever internal systems it needs to have to work for the user. In general, if you copy block-by-block from one raw device to another, it will be an exact clone of the original.


HDDs include partition table (do google search on this term). Flash cards and Flash USB disks don't usually have partition tables and if this is the case, OS just asks each file system driver "is it your file system?".

As for cloning - if you copy the device to the identical device, you will have a clone. If HDDs have different configuration (different number of cylinders, heads etc.), then cloning is not that easy, but also possible. Flash cards are usually copied block-by-block and cloning is trivial. There exist applications like Acronis Disk Director or Norton Ghost that do such cloning. You can take a trial and play with it.


And some more detail you never wanted to know:

Every partition table I know of stores some information about the partition type:

  • "MBR" (IBM/PC) has a "partition type" per partition. 0x00 is free space, and the rest are "allocated" by whoever gets there first (I think there have been some collisions). Linux uses a single partition type (0x83) for all its filesystems, presumably to reduce collisions, and just asks all the filesystem drivers. Microsoft uses a different type for each filesystem type (IIRC there are two different FAT16s or FAT32s; I can't remember).
  • "APM" (Apple_partition_map, a.k.a. "Classic" Mac) stores a partition type string (up to 31 characters or so).
  • "GUID" (EFI's "GUID partition map", used on Intel Macs) stores a partition type GUID. GUIDs are effectively guaranteed to be unique.

A byte-for-byte copy usually works, provided both devices have the same sector size (since a lot of offsets/sizes are specified in sectors instead of bytes). Nearly every hard disk and flash drive use a sector size of 512 bytes, but there are some exceptions:

  • Some iPod Shuffles seem to use 2048 bytes. Apparently you can sometimes boot a CD image from one (CD-ROMs generally have 2048-byte sectors).
  • Some newer hard drives have 4096-byte sectors (with a compatibility jumper to pretend to have 512-byte sectors).
  • Some "enterprise" hard drives support slightly larger sectors (e.g the Barracuda ES.2 has 512, 512+8, 512+12, 512+16). The extra bytes are presumably useful for encrypted disks.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜