Thursday, 15 January 2015

How to create disk partition in Linux/Unix ?


Hi Friends today I am going to tell you "How to create disk partition in Linux/Unix operating system?"

Note: Since I am an Oracle Database Administrator so this blog is for those guys who work on Linux/Unix on his/her Laptop/PC to learn oracle database . So  Please contact your System Administrator before implement it on server.

Let's start:

Step1: To verify the added disk:

#fdisk  -l

It will show list of disks added to your linux OS. Suppose newly added disk is :

/dev/sdb

Step2: To create partition of disk.

          1. #fdisk   /dev/sdb

                Hit 'm' to see help of options.

          2. Hit 'n' to create new disk.
          3. Hit 'p' for primary partition or 'e' for extended partition.
          4. Enter partition number '1'.
          5. Hit Enter. (Default Cylinder 1)
          6. Enter value in sizeM(500M) or as cylinder number or hit enter to accept default.
          7. Hit 'w' to save the partition.




Step 3: This partition will come in action after reboot but you can do it without rebooting  the system.

#partprobe /dev/sdb

Step 4: To mount the disk.

       1. mkdir  <new mount point folder like /u02 >
       2. mkfs   -t  ext3   <new partition name as /dev/sdb1 > 
        3.  mount   -t   ext3   /dev/sdb1  /u02
Note : Replace data in angular bracket including angular brackets with its value.

Step 5: To make this mount permanent.

      Add this line in '/etc/fstab' as :
       
                 <Partiton Name>     <Mount Point>        ext3         defaults       0  0
     Ex :          /dev/sdb1             /u02                          ext3         defaults      0   0
     
      Save and exit from file.
   
      Step 6: To make system to read this file without reboot.
       # mount   -a