Monday, August 19

Disk Management Concept on Linux (Redhat or CentOS 6)

View All Existing Disk Partitions Using fdisk -l

Before you create a new partition, or modify an existing partition, you might want to view all available partition in the system.

Use fdisk -l to view all available partitions as shown below.
  device info will present under /dev

     ide ------------------   /dev/had

    sata------------------   /dev/sda

For Creating a Partition

[root@bsrtech sysusers]# fdisk   /dev/sda

     m – To get  the help
     p  -  To print the partition table
     n  -  To create a Partition
     d – To delete a   Partition
     w  -  To save the modification
     q  - To quit without save
     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 ext4)
    mkfs.ext4 /dev/<partition no>
       ex: mkfs.ext4 /dev/sda5

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 <partition> <mount point>

ex: mount /dev/sda5   /redhat

umount : is the command to clear mounting way.

    syntax: umount < mountpoint>

    ex: umount /redhat

To mount a partiton permanently, we have to edit configuration file

# vi /etc/fstab
add a line at the end

<partition>   <mountpoint>   <filesystem>   <permissions>   <fsck>
  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/sda5      /redhat          ext4              defaults                  1  2
         |                          |                    |                     |                      |
         |                          |                    |                     |                      |
     partition    mountpoint   file system    permissions             fsck


  1. awesome writing. just a thing "partprobe" command will work in RHEL5 not in RHEL6. for RHEL6 U have to manualy restart. it's a bug

  2. update kernel using partx command

    partx -a /dev/sda


:: Linux - Legends ::