Disk Management Concept on Linux

Disk Management Concept on Linux
fdisk -l : is the command to view current partitons
device info will present under /dev
/dev/sda :
ide —————1)primary master——————/dev/hda
                   2)primary slave——————-/dev/hdb
                   3)secondary master—————-/dev/hdc
                   4)secondary slave—————–/dev/hdd
sata————–1)primary master——————/dev/sda
                  2)primary slave——————-/dev/sdb
                  3)secondary master—————-/dev/sdc
                  4)secondary slave—————–/dev/sdd
we can create 4 primary partitions and eleven logical partitons in a harddrive.(SATA)
fdisk : is the command to create partitions.
syntax : fdisk /dev/
ex: fdisk /dev/sda
n : for new partition
(if we want to create a new primary partition already existing primary partitions will be deleted.
so we will go for logical partitions)
l : logical
(we can’t able to specify space in inodes )
press enter
(provide size of partition)
+200M(here our partition size is 200 mb)
w: to save partition and write to partition table
partx: Is the command to update kernel with out reboot.
  (partx -a /dev/sda)
to format a partition ( linux file system is ext3)
mkfs.ext3 /dev/
ex: mkfs.ext3 /dev/sda13
mke2fs -j /dev/sda13 (along journaling)
df -Th : is the command to view mounted partitions along with mount points & free space
mounting : mounting is a process to create a logical way to enter a partition
mkdir /redhat (mount point for drive)
mount :is the command use to view mounted partitions & to create mounting.
syntax: mount
ex: mount /dev/sda13 /redhat
umount : is the command to clear mounting way.
syntax: umount
ex: umount /redhat
to mount a partiton permanently
we have to edit configuration file
vi /etc/fstab
add a line at the end
fsck: filesystem consistency check
if fsck is 1 1 only root can access
if fsck is 1 2 any body can access
if fsck is 0 0 only system can access
/dev/sda13      /redhat          ext3              defaults            1  2
    |                     |                    |                     |                     ——- 
    |                     |                    |                     |                      |
partition    mountpoint     file system permissions          fsck
To assign a label
ex : e2label /dev/sda13 /songs
To view existing label
ex : e2label /dev/sda13
To see mounted partition with label
#mount -l
SYNTAX : fdisk /dev/sda
n(for new)
specify size (Ex : +100M)
t (for toggling)
specify partition number
type 82(code for linux swap)
w (save and write in to partition table)
partprobe (to update the kernel without reboot)
SYNTAX : mkswap
ex : mkswap /dev/sda13
To enable swap on the swap partition
SYNTAX : swapon
ex : swapon /dev/sda13
To check the status of swap
SYNTAX : swapon -s partition
ex : swapon -s /dev/sda13
To disable swap partition
SYNTAX : swapoff
ex :swapoff /dev/sda13
To mount floppy drive
# mount /dev/fd0  /mnt(mountpoint)
To mount cd rom
# mount /dev/cdrom /mnt(if mount point is not there)
To mount pendrive
# mount /dev/sda1 /mnt
To eject the cd rom tray
# eject
to close cdrom tray
# eject -t
To mount tape drive(scsi)
# mount /dev/st0 /mnt
To mount tape drive (ide)
# mount /dev/hto /mnt
To view total free space of a disk
# hw browser&
To view free space of partition
# df -h

Leave a Reply

Your email address will not be published. Required fields are marked *