Skip to main content

SETTING PARTITION IN CENTOS


#lsblk   (to view all partitions available)
This will list the available space

  
#fdisk /dev/sdc


(Select n
Then p for primary e for extended
Give size
w for save)
similarly we can create multiple number of partition based on requirement.

Then we need to assign a file system to the created partition.Here we are assigning ext3 file system. 
#mkfs -t ext3 /dev/sdc

Now create mount point.ie,the directory to which we want to mount
#mkdir /disk

Open fstab file inorder to permenently mount a file system.
#vi /etc/fstab
Here we gave details about
UUID  mountpoint  filesystem defaults 0 0
(note:here fst zero indicates wheather disk is to be backed up.0 indicates no
Second 0 indicates wheather fscheck is needed or not.0 means no fscheck.
We can give these value no issue in it)

To know the UUID blkid command can be used
#blkid /dev/sdc1

After editing fstab file run partprobe command to reload partition table
#partprobe

Type the followinng command to mount it.
#mount /dev/sdc1 /disk

Now
#df -h will give details about our mounted partition

FOR DELETING THE DISKS

# fdisk /dev/hdb
Command (m for help): p
Command (m for help): d
Partition number (1-4): 1

Verify that partition deleted:
Command (m for help): p
Now save the changes and exit to shell prompt. Type the w command:
Command (m for help): w

Also remove entries from /etc/fstab
Now reboot the system
#reboot