THIS POST IS ALL ABOUT HOW TO DELETE PARTITION IN LINUX .

 

In this post i’m gonna to show you how to delete partitions in Linux .

 

  • First check how many partitions you have in your system by fdisk  -l command .
[root@localhost ~]# fdisk -l
Disk /dev/sda: 50.9 GB, 50985402368 bytes
255 heads, 63 sectors/track, 6198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957686   83  Linux
/dev/sda2            5100        5736     5116702+  82  Linux swap / Solaris
/dev/sda4            5737        6198     3711015    5  Extended
/dev/sda5            5737        5798      497983+  83  Linux
/dev/sda6            5799        5860      497983+  83  Linux
  • I’m going to delete sda 5 and sda6 but before doing that we have to check its been mounted or not .Type df  -h command to check .
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              38G   12G   25G  32% /
tmpfs                 887M     0  887M   0% /dev/shm
/dev/sda5             471M   11M  437M   3% /root/D
/dev/sda6             471M   11M  437M   3% /root/A
  • As its showing sda5 and sda6 is been mounted in Folder D and A respectively . So type umount and folder name where its mounted to unmount .
[root@localhost ~]# umount D
[root@localhost ~]# umount A
  • Check again whether its been mounted or not . As you can see it’s been unmounted .
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              38G   12G   25G  32% /
tmpfs                 887M     0  887M   0% /dev/shm
  • Now we can delete partitions .
[root@localhost ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 6198.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Partition number (1-6): 6

Command (m for help): d
Partition number (1-5): 5
  • Command d is for delete the partition . Then it will ask which partition you wanna delete . Type command p (print) to check whether its been deleted or not .
Command (m for help): p

Disk /dev/sda: 50.9 GB, 50985402368 bytes
255 heads, 63 sectors/track, 6198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957686   83  Linux
/dev/sda2            5100        5736     5116702+  82  Linux swap / Solaris
/dev/sda4            5737        6198     3711015    5  Extended
  • Command w is used to save changes .
Command (m for help): w

The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
  • To save changes happen in this disk , Type partprobe command . It will save changes after system reboot .
[root@localhost ~]# partprobe /dev/sda
  • Now you can check by fdisk  -l command sda5 and sda6 partition is been deleted .
[root@localhost ~]# fdisk -l

Disk /dev/sda: 50.9 GB, 50985402368 bytes
255 heads, 63 sectors/track, 6198 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957686   83  Linux
/dev/sda2            5100        5736     5116702+  82  Linux swap / Solaris
/dev/sda4            5737        6198     3711015    5  Extended

So this how you can delete partition in linux .

CHECK OUT MY VIDEO , IF YOU GOT ANY PROBLEM IN DELETING .

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s