Monday, September 7, 2009

Devices

Charcter / Raw Devices:
- A Raw device is a device that allows only "serial" access

Block Devices:

- A Block device is any device that allows "random" access
- Ex: Hard disk, disk partitions, RAM, Logical Volumes, RAID volumes
- It can be used for file systems, swaps, RAID, LVM
- Have a special file in /dev

Floppy Disks:
- Floppy disks have special files from /dev/fd0, /dev/fd1 .. upto 8 files/devices

Hard Disks:
- Mostly used types are IDE and SCSI

IDE:
- IDE Disks have special files from /dev/hda, /dev/hdb .. upto 8 files/devices
- Maximum 2 disks on 1 bus, 2 buses on 1 adapter, 2 adapters in a system.


SCSI:
- Depending on the scsi type, you can have maximum 7 or 15 disks on 1 bus
- SCSI Disks have special files from /dev/sda, /dev/sdb .sdz, then sdaa thru sddx. upt0 128 files/devices
- Also includes SD, DVD-ROM, tapes, ..
- Linux kernel supports a total of 128 SCSI disks by default

Partitions:
- Maximum of 4 primary partitions
- you can have 1 extended partition as a primary partition
- An extended partition can have multiple logcal partitions
- By deafult, linux supports 59 logical partitions on IDE and 11 logical on SCSI disks
- Partitions can be created using "fdisk /dev/sdx" command
- To view current partitions, use "fdisk -l" command
- Each partition can be of types Linux, Linux Swap, Linux LVM depending upon the usage

RAM Disk:
- Is a block device created in memory

- Is temporary, gets deleted after reboot

- By default Linux supports upto 16 RAM disks and maximum 255 RAM disks

- Use 'dd' command to create a RAM disk
# dd if=/dev/zero of=/dev/ram1 bs=1k count=4096

- To delete a RAM disk,
# freeramdisk /dev/ram1
- initrd (Initial RAM disk) is a compressed ramdisk image which is mounted as initial root filesystem
- Use 'mkinitrd' command to create initial ram disk

No comments: