How to delete partition in linux system step by step guide with practical examples



 Delete Partition in linux using fdisk | In this article we learn how to delete partition using fdisk .

It is very essential task for a system administrator to manage the user data. If you required additional hard drive to store  data we have to add the additional hdd and  create a new partition for it. If we don’t aware about the operation when we delete a partition there is a chance to lost the user data.

Verify the partition list before deletion a partition

When we are going to delete a  partition of our linux system to fulfill our requirement first of all  we have to view the partition table before do this. To view the partition table we execute the below command.
#fdisk -l
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1045     7875584   8e  Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x48bf2abc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1           8       64228+  83  Linux

Fdisk Delete partition 


Then  we unmount the  partion which we are voing to delete using “umount”command. Then remove  the entry from /etc/fstab file  to permanent unmount the partition.

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      6.5G  4.6G  1.6G  75% /
tmpfs                 244M     0  244M   0% /dev/shm
/dev/sda1             477M   72M  376M  17% /boot
/dev/sdb1              57M  1.3M   52M   3% /test

[root@localhost ~]# umount /test

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      6.5G  4.6G  1.6G  75% /
tmpfs                 244M     0  244M   0% /dev/shm
/dev/sda1             477M   72M  376M  17% /boot

Now we are going to delete the /dev/sdb1 partition .to do this activity we execute the below task.

[root@localhost ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x48bf2abc

   Device Boot      Start         End      Blocks   Id  System

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 or after you run partprobe(8) or kpartx(8)
Syncing disks.

How to delete partition in linux system step by step guide with practical examples,Fdisk Delete partition
How to delete partition in linux system step by step guide with practical examples


First we press “d” key to deleted the partition and then press “p” key to view the partition table and to save it press”w” key.
Now to update the partition table online  we have to execute “partprobe” command.

If this article is helpful to know about Delete Partition in linux using fdisk please share and subscribe this article.


SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment