Windows has a directory tree for each drive. Each tree begins with a drive letter.
Linux has only one tree called the filesystem. It starts with the symbol for the root directory: '/'. (There is a special user also called root. User root's home directory is '
/root
'. Be careful not to confuse the two.) The root directory has some subdirectories: -
bin
- Essential command binaries -
boot
- Static files of the boot loader -
dev
- Device files -
etc
- Host-specific system configuration -
home
- User home directories -
lib
- Essential shared libraries and kernel modules -
media
- Mountpoint for removeable media -
mnt
- Mountpoint for mounting a filesystem temporarily -
opt
- Add-on application software packages -
root
- Home directory for the root user -
sbin
- Essential system binaries -
tmp
- Temporary files -
usr
- Secondary hierarchy (for user-installed applications) -
var
- Variable data
In Linux, the user never needs to know which physical drive contains particular data. This is unlike Windows where you need to know which drive (C:, D:, etc) to use. Instead, in Linux you mount a drive to a particular mountpoint in the directory tree. For instance, the first CD drive in Windows might be D: or E: or some other drive letter and might change if other drives are added to or removed from the system. In Linux, the mountpoint for the first CD drive is
/media/cdrom0
. The mountpoint does not change if you add or remove devices, although you can add a convenient symlink (shortcut) to the filesystem such as /cdrom
.
If you install an application in Windows, the executable and related files are normally installed to
C:\Program Files
. In Linux, - application executable files (binaries) are installed in
/usr/bin
, - manuals in
/usr/share/man
, - other documentation in
/usr/share/doc
, - etc.
Linux does not have a registry. Configuration data is normally in the form of text files installed in
/etc
. Disc devices and partitions
In Windows, the active primary partition on the primary master IDE disc is called C:. Other partitions (and CDROM drives) are called D:, E: etc. In Windows 98 and earlier, the allocation of drive letters to partitions is automatic and fixed. From Windows NT onwards it is possible to reassign some drive letters.
In Linux, it is often said that "everything is a file". In the case of discs, the whole primary IDE master disc is the device
/dev/hda
, the primary slave is /dev/hdb
, the secondary master is /dev/hdc
and the secondary slave is /dev/hdd
.
The first SCSI hard disc is
/dev/sda
, the second is /dev/sdb
etc. SCSI CD or DVD devices are /dev/scd0
etc.
PATA drives (connected with flat cables) are treated as IDE ATA drives (
/dev/hda
etc). SATA drives (not connected with flat cables) are treated as SCSI drives (/dev/sda, /dev/sdb
etc).
It is possible to have up to 4 primary partitions on a hard disc. One of them can be an extended partition containing up to 63 other logical partitions. The logical partitions must be contiguous. Windows uses only one primary partition and one extended partition containing logical partitions. Linux can use all the partitions, but manual configuration is needed to use more than 20 partitions per disc in Debian.
If
/dev/hda
is formatted with two primary partitions, the partitions would be /dev/hda1
and /dev/hda2
. In a typical dual-boot (Windows/Linux) system, primary partition 1 will be Window's drive C:, so this can be accessed as /dev/hda1
. Partition 2 (/dev/hda2
) will be Window's extended partition, though this never needs to be accessed directly. Partitions 3 and 4 will be unused, and 5 upwards are the partitions within the extended partition. Partition 5 will be D: or /dev/hda5
.
CD or DVD drives cannot be partitioned. A typical CD drive would be
/dev/hdc
(IDE) or /dev/scd0
(SCSI).
In Windows, there may be two floppy drives, A: and B:. In Linux, the floppy drives are
/dev/fd0, /dev/fd1
etc. Mounting and unmounting devices
Everything in Linux is a file - including devices such as disc drives. In order to use a drive, you must mount the device to a mountpoint in the filesystem. You can then access the drive from the mountpoint. For example, you may wish to use another hard drive to store backups of your system. To add manually an EXT3 formatted partition
/dev/hdb1
you might create a new directory /mnt/backup
as the mountpoint. You can then mount the partition with the mount
command $ mount -t ext3 /dev/hdb1 /mnt/backup
and unmount it with the
umount
command (NB only one n) $ umount /mnt/backup
or
$ umount /dev/hdb1
The configuration file
/etc/fstab
contains the details of devices which are mounted automatically at boot time.
Removable media can be automatically mounted if you install an automounter. The X-window desktop Gnome includes automounting as standard. The media will not unmount or eject until all processes involving it are finished. In Gnome, right-click on the CD icon and choose eject.
Filesystem formats
The most common Linux format is EXT2 (the Second Extended file system format). Recent distributions use EXT3 which is EXT2 with a journaling system. The journal protects against corruption of filesystem data which might cause lost files etc. As well as being robust, EXT2/3 partitions are efficient and do not need to be defragmented. They can be checked and repaired with the filesystem checker
fsck
which is similar to scandisk in Windows.
Windows cannot access native Linux formatted drives, but Linux can read from and write to other formats such as FAT, FAT32, etc. However, writing to NTFS is not recommended (see http://linux-ntfs.sourceforge.net/info/ntfs.html#3.2).
More Information :
No comments:
Post a Comment