Hi friend’s welcome back to helpingyouonline, today i am back with a basic Linux tutorial. I am going to share how to create and delete partition in Linux . This tutorial is dedicated to beginners who are new to Linux .
This tutorial covers ===>
>how to create a partition in linux?
>how to change type of a partition in linux?
>how to delete a partition in linux?
so Let’s get started ==>
Partition creation in Linux
Step 1.– (Device Identification)
First of all check the partition table using fdisk command.
using fdisk command we can identify that the device is your Internal Hard disk or External hard disk.
Now we use fdisk command to create a partition ==>
>now follow below process step by step ==>
:m ==> for help
:n ==> it will create a new partition.
:p ==> to view or to print the partition table
:w ==> to save all the changes.
#partprobe ==> to update partition table without reboot.
Note ==> if partprobe command does not work then simply reboot your linux system.
Now to make filesystem we have to format the partition /dev/sda5 using mkfs command.
here .ext3 is file system type
Step 4 .
Now to use the partition on Linux system we have to mount it on a directory.
>First create a directory with mkdir command ==>
Here / indicates that directory is created on root.
Step 5 ->
Now simply mount the partition on /new directory
#mount /dev/sda5 /new
Now we will check that the partition is mounted or not ==>
If we reboot now then the partition will unmounted automatically, it happens because the partition is mounted temporarily, to make it permanent so that it will not change after reboot or shutdown we have to do its entry in /etc/fstab file
now go to the file–
/dev/sda5 /new ext3 defaults 0 0
Here /dev/sda5 is the newly created partition , /new is the directory on which the partition is mounted and ext3 is the file system type and rest are default values.
>So we have successfully created a partition /dev/sda5
>Now check the newly created partition with fdisk command==>
Output of above command is shown below=>
Read more ==>
how to change partition type in Linux??
There are two ways =>
1>First you can change the type of partition at the time of partition creation.
2>Second you can change the partition type at any time but to do it you have to unmount the partition first.
Lets change the partition type using second type =>
>First unmount the partition /dev/sda5.
>Now use fdisk utitlity to change type as shown below==>
>Follow below process to change the type of partition ==>
:t ==>to change the partition type
:5 ==> number of the partition.(/dev/sda5)
:L ==> to list the partition type with appropriate codes for individual type.
:fd ==> i have selected fd code from above list of codes, fd refers to linux autoraid partition type
># partprobe ==> to update the partition table without reboot.
>Now you will see that the type of partition is successfully changed
how to delete a partition in Linux ??
To delete a partition in Linux simply follow below steps ==>
First of all remove the entries from /etc/fstab file
Simply erase the entered line or put # sign before the line.
Now unmount the partition
Now use fdisk ==>
:d ==> is used to delete the partition
:5 ==> number of partition which you want to delete
:w ==> save and exit
Use partprobe to update the partition table without reboot.
Now check the partition table
>So today we have learned how to create a partition, how to change its type and how to delete a partition in Linux . As you see its very easy to manage partitions in Linux .
>Hope you like this article, follow us and share this article to facebook , twitter for more exciting articles.