Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to know what the major differences are between Windows and Linux file creation.

Let's say I'm in a terminal session and I type: touch file. What happens behind the scenes in Linux? What is the process in the operating system?

share|improve this question
    
This question is more suitable for unix and linux stack exchange site –  Tachyons Mar 18 '12 at 2:40

1 Answer 1

up vote 4 down vote accepted

In Linux when you make a file:

  1. An inode is generated. This is a descriptor that points to data blocks on the disk that also stores information like ownership, permissions, etc.
  2. A hardlink to that inode is created. This is essentially the "filename" and where it sits in the rest of the filesystem.

It can be a confusing concept at first to get your brain around but it's quite simple. Inodes are there as sign posts to the actual data but in order to use any of that you need the hardlinks to show the structure of the filesystem.

This allows you to have multiple hardlinks to one inode, for example, as long as they're both on the same partition.


In Windows (and this may become untrue as Microsoft evolve their filesystems) the inode and hardlink are not separate, they are one and the same. This means when you create the file it just creates this block.

Obvious side effects are that multiple-hardlinks don't exist but it's more than that - you often can't delete a file (which would be just removing the hardlink in Linux) that is locked for opening (which would be handled by inode data in Linux).

But other than that (fairly major) difference, they're quite similar.

Turns out that Since Vista, NTFS works very much like common Linux filesystems. It supports both hard and soft links suggesting they have an inode-like object between data and path.

In short: There isn't much difference these days. On older versions of Windows than Vista, my scrubbed answer above carries.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.