Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Thursday, April 23, 2009

File management system in Windows XP and Linux (Ubuntu)

Directory Structures

Directory structure is the method used to organize the directory data within the directory
Both Windows and Unix Directory structures have lot of common features like the way files and directories are organized on a hard disk. They implement a tree-structure, or hierarchical, file system. A directory can contain any number of files. A directory can also contain other directories. The main difference between windows and linux file directory is windows can have many roots while

linux Directory structure

Linux directory structure is organized into a hierarchical structure which is similar to an upside down tree. The top-most directory is known as the root the starting point of the directory structure When the operating system is first installed, it creates a root file system and it is written as a forward slash (/).
Eg- /usr/data/cat

The root can contain many directories, each directory can contain subdirectories; each of these can contain more subdirectories, and so on. A subdirectory is said to be the "child" of the directory that holds it (it's "parent")
Eg- The following diagram shows file organization structure used in linux

If you want to go to the DB directory u have to go like “ /Data/Tutorials/DB”

Windows Directory structure

Windows file system has lot of similarities with Unix file system, it is also organize in a hierarchical structure .And also it can contain directories and sub directories inside it

The main difference between windows and linux is Windows can have many roots while
Linux only has one root. Microsoft Windows storage devices such as hard disks, floppy disks, CDROM's and Zip drives that contain file systems have a drive letter prefix. Floppy drives are typically A: drives, hard disks typically C:, etc.
In linux when you need to use a storage device user has to mount the device and go from the root directory because it has only one root structure

And also another important thing in directory structure is that in windows uses a backslash (\) as a delimiter between directory names while UNIX uses a front slash (/)

Eg- C:\Sun\AppServer\jdk\bin
H:\Course work IIP\Images
Both windows and linux can share files and folders with other computers by connecting to a network

Location of various task and users

Various task and operations which are done by linux operatin system

An operating system must provide a number of operations associated with files so that users can safely store and retrieve data. Typical operations are open close create coppy rename and list. In addition, operations on a single data elements within a file are supported by Read Write and Seek. Both operation system act as the same way

User location

Both linux and windows can be used by different users but in linux system allow to have multi users at the same time, but in windows only one user can log in at a one time

File organization

Linux file organization

Unix files and directories numbered, using node numbers called inodes, and that’s how unix keeps tracks of the files and directories. An inode is a data structure on the disk that describes a file. It holds most of the important information about the file, including the on-disk address of the file's data blocks (the part of the file that you care about). Each inode has its own identifying number, called an i-number

Each i-node entry contains
  1. The user and group id of the owner
  2. It’s protection bits
  3. The physical file address
  4. File size
  5. Number of links to the files
  6. A code indicating if the file is a directory, special,symbolic link or ordinary file
  7. date/time of access, creation and modification.

When a file gets deleted under Unix, the name is removed from the file system but the file doesn't go away until the INode is deleted. this happens when the last process using the file closes it . if you create a new file with the same name, while the old one is open, you get a new Inode.

Windows File Organization

Windows does not have inodes , the file name and file are managed as a single entity,and windows cannot identify the separation between name and identity. The good thing in unix using inode is it can have many different files open simultaneously,all of which may have shared a common name at some point
In Windows file access is done by the file system if we look at windows XP the file system they use is NTFS ,and the information about the files are stored in the file system

Types of files


Main types of files in the unix file directory

character special
symbolic link
block special
1.Ordinary files –Ordinary file may contains text, a program or other data.It can be
either an ASCII file, or a binary file
2.Directory files(socket)
3.Device Files –Physical devices(printers,speakers ect) are represent as file
In linux these devices are read as files and can access them as
Separate files not as devices.When we use the device we have to attatch
to the tree structure and use it not as a separate device
4.Link files – A symbol link is a filename that links to another can appear to
have two diferant names , or alternatively appear to be in two
different places in a directory hierarchy. . Directory entries point to
file difining i-node It important to remember in unix if the original
file is deleted the The link becomes useless and also you cannot create
links to directories


In windows is also the same as linux file types. In windows they have shortcuts as the symbolic link. It also has the similar qualities.
In windows Physical devices are identified separately and can be accessed as a another root


A file extension is a more or less arbitrary component of a filename, used to identify the type A failing of file extensions is that any extension can be applied to any file, so the extension is no guarantee of contents. The extension takes the form of a 'dot' and various letters, usually three, appended to the filename.

Linux File extension

We use file extension to identify the file types.The main difference between unix and windows file extension is that in unix we can use multiple extension
Eg name.tar.gz -Tarred-then-gzipped files -C++ program source code
And also in linux file extention is not needed to identify the file type but in windows extention is used to identify the file type

Some of the extensions used in Unix

.bak Backup copy of file .bz2 bzip2 compressed file
.c C program source code .C C++ program source code .cc C++ program source code .cgi CGI web page program .dat Data or other information .doc Explanatory text file

Windows file extension
In windows we can only use single extension. If the user gives more than one extension ,the extension is taken as the last word which starts with the period and the left hand side of the last period is taken as the file name.In Windows operating systems, the file type is derived from the filename extension. Typical file types and their extensions are
File Extension
File Type
basic source program
c source program
system library
Word document
executable program
text file
Windows associates applications (programs) with specific file types. For example, the default application that opens to process a file of type .txt is the Notepad editor.
Overall, Unix/Linux file extension development has been fairly random. Since extensions are so useful and indicative, and as Unix/Linux has become increasingly graphically oriented (thus needing to execute applications and load files indirectly), extensions have become more prevalent and naturalized.  

Disk fragmentation

When the system is used for some time,constant creation and removal of files ceates a situation called disk fragmentation. When files are created and data written to the file, the operating system allocates space for the file from the free cluster list. Over a period of time, the clusters that are allocated to a file may no longer be sequential (contiguous or one after the after) but scattered over the disk.This means files in the files system are written in small pieces on the hard disk, thus scattering the available disk space. Disk fragmentation increases access time and reduces filesystem efficiency.

Both operating system may suffer from disk fragmentation
Unix file system is designed largely to prevent fragmentation. In Linux we have a separate swap partition that has several advantages
- The swap file system is optimized for its purpose, it's faster.
- No time wasted resizing.
- Much less fragmentation.

Its needless to do disk fragmentation in linux, because most of the time in linux fragmentation will not reach higher. Most of the time fragmentation will not increase more than 5%.
To defragment a file system is to back up the files system with a program such as
dump or ufsdump, rebuild the file system with a command such as newfs or mkfs, and then reload the file system from the backup.
Windows gets fragmented so quickly is that it uses a swap file in the same partition as the rest of the system, and this file changes in size all the time, pushing bits and pieces of other files around.
Disk Defragmenter MMC is based on the full retail version of Executive Software Diskeeper. The version that is included with Windows XP and later provides limited functionality in maintaining disk performance by defragmenting volumes that use the FAT, FAT32, or NTFS file system.

No comments:

Post a Comment