in reply to Re: renaming a file and moving into another folder
in thread renaming a file and moving into another folder
But all the schoolbooks show the hard drive to be a big file cabinet, with multiple drawers, labeled A- Z. Did my teachers lie to me ? :-)No. I wouldn't say that they "lied". I would say that they simplified things at the beginning and you may have missed the reality checkpoints later in the curricula. Please do not get offended. This misconception is common. In Unix you should look at the link count associated with a file.
Basically I am saying that the file system directory associates a text name with essentially a starting byte number on the hard drive. There can be more than one text name associated with the same byte number on the hard drive. These are called "hard links".
So, I would say that it is a pretty good approximation to say that the hard disk gets divided up into blocks. A file is just a name in the directory that points to a sequence of these blocks. More than one file name can point to the same sequence of blocks. These blocks on the hard drive are not reused until the reference count to them drops to zero (this just like Perl reference counting).
So, a more accurate description would be that there are file cabinets with drawers, folders and documents. You have a spiral bound book that associates a "text name" and a file/folder in cabinet1, drawer2, folder3,document5. There may be more than one name in your spiral bound book that points to exactly the same place! Your spiral bound book is what a directory entry is.
|
|---|