TimeLinux1

Thursday, October 14, 2010

Linux HowTo: Disk Types and commands

Three prominent Disk types in Linux:
         . ide   - low cost, smaller     - stands for 'Integrated Drive Electronics', usually seen in home computers
         . pata - same as ide             - stands for 'Parallel Advance Tech Attachment (from PC - AT Days)
         . scsi  - bigger, better perf   - stands for 'Small Computer System Interface', usually seen in servers
         . sata  - improved ide          - stands for 'Serial ATA'
-To see disk info:
         # cat /dev/hdx - ide
    or  # cat /dev/sdx - scsi
         . /dev is a virtual fs like /proc & /sys.
-Note:
         . Although scsi / sata are 'serial' bus technologies as opposed to ide / pata which are 'parallel' bus tech, the performance of scsi / sata is generally better due to their superior engineering and bus size; scsi / sata is also more expensive than ide / pata.
        
-scsi :
          . was designed for connecting streaming devices like tapes and block devices like disks, cds, dvds etc. but now extended to printers/scanners.
          . was designed to allow multiple devices on one bus--the bus-controller controlling the data traffic.
-scsi defined by ANSI.
-useful files and cmds:
          # cat /proc/scsi/scsi, scsi_info, sginfo.

-USB
-usb 2.0 supports speeds upto 480 Mbps.
-usb cable has 4 wires - two for signals and one each for power and ground.
-To see usb info:
          # cat /proc/bus/usb
          # cat /proc/bus/usb/devices

-Linux filesystem is a single fs with the / as the top root dir.
-To view the different devices like floppy, cdrom etc, on the same fs, you mount them on their mount points.
-In this regard, different mount points are treated as different devices.
-This is different from Windows where every drive letter (A, B, C..) has its own fs.

-some example dirs under / :
          . bin     - essential cmd binaries
          . sbin    - essential system binaries
          . lib       - essential libraries & kernel modules.
-disk partition names:
           . /dev/hdx - ide
           . /dev/sdx - scsi / sata
-sector     = 512 bytes
-track      = sum (sectors) in one read of disk arm
-cylinder  = sum (tracks) in one read of disk arm

-Partition types:
           . primary - one of the 4 partitions limited by the master boot record (mbr); mbr resides in the 1st sector of the disk (ie the first 512 bytes).
           . extended - one of the primary partitions that is logically broken to create more than 4 partitions.
           . logical - one of constituents of the extended partition.

-The boot partition must be a primary partition and reside completely in the first 1024 cylinders;
-this is because the bios can't read or boot from the boot partition, if this condition is not met.
-usually 100 MB for boot partition is ok.

-partition recommendations:
            . first define boot
            . then define swap
            . then define root ( / ), /usr, /opt, /var in a single large partition (usually / )
            . after that define rest of the system like /home etc.

-Note: even if a system can have 4 primary partitions, it can still have more than 4 bootable os partitions; this is possible bec of boot-loaders.
-eg. of boot loaders = grub, lilo, bootmagic.

No comments:

Post a Comment