Disk Management or Disk Partitions

Disk Partitions or Disk Management-


Disk Management 

All Existing Disk Partitions Using     fdisk -l

fdisk -  command using the partitions

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

Creating a Partition

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

Options-

     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

Note- 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 compulsory

+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
   /etc/fstab

# 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

ex:

/dev/sda5     /redhat        ext4            defaults                  1  2
       |                          |                    |                     |                      |
       |                          |                    |                     |                      |

     partition    mountpoint   file system    permissions             fsck

Comments

Popular posts from this blog

Job Scheduling or Scheduling jobs Manually

System Run level or INIT Process

Linux Basic Commands and Memory relarated commands Very usefull