Operating System - Linux
1752793 Members
6142 Online
108789 Solutions
New Discussion юеВ

Re: how to delete partition and create new one

 
hangyu
Regular Advisor

how to delete partition and create new one

/sbin/fdisk -l /dev/sdd

Disk /dev/sdd: 18.2 GB, 18210036736 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 298 2393653+ fd Linux raid autodetect
/dev/sdd2 299 935 5116702+ fd Linux raid autodetect
/dev/sdd3 936 1572 5116702+ fd Linux raid autodetect
/dev/sdd4 1573 2213 5148832+ f Win95 Ext'd (LBA)
/dev/sdd5 1573 2082 4096543+ fd Linux raid autodetect
/dev/sdd6 2083 2213 1052226 fd Linux raid autodetect


I would like to remove all all partition and group them into one partition , i tried fdisk
/dev/sdd then press "d" , it ask which partition , i then try from 1 to 6 , but it still not work , can advise what is wrong ? thx
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: how to delete partition and create new one

Shalom,

Did you type w to write your changes after running the d command?

partprobe after exit?

One of the partitions may be locked and you might be better off booting into single user mode and trying again.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
hangyu
Regular Advisor

Re: how to delete partition and create new one

thx reply,

Did you type w to write your changes after running the d command?

partprobe after exit?

what you mean type w ?

I tried to input from 1 to 6 below but not work , what is wrong ?

a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): d
Partition number (1-6):
hangyu
Regular Advisor

Re: how to delete partition and create new one

I got it , thx much.
skt_skt
Honored Contributor

Re: how to delete partition and create new one


Below is a documented example.

# fdisk /dev/emcpowerc

The number of cylinders for this disk is set to 8802.
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): p

Disk /dev/emcpowerc: 255 heads, 63 sectors, 8802 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/emcpowerc1 1 6267 50339646 83 Linux
/dev/emcpowerc2 6268 7312 8393962+ 83 Linux
/dev/emcpowerc3 7313 8357 8393962+ 83 Linux
/dev/emcpowerc4 8358 8802 3574462+ 5 Extended
/dev/emcpowerc5 8358 8580 1791216 83 Linux
/dev/emcpowerc6 8581 8802 1783183+ 83 Linux

Command (m for help): m

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

To delete the existing partition

Command (m for help): d
Partition number (1-6): 6

Command (m for help): p

Disk /dev/emcpowerc: 255 heads, 63 sectors, 8802 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/emcpowerc1 1 6267 50339646 83 Linux
/dev/emcpowerc2 6268 7312 8393962+ 83 Linux
/dev/emcpowerc3 7313 8357 8393962+ 83 Linux
/dev/emcpowerc4 8358 8802 3574462+ 5 Extended
/dev/emcpowerc5 8358 8580 1791216 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

To add a new partition

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8802, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-8802, default 8802): +61000M

Command (m for help): p

Disk /dev/emcpowerc: 255 heads, 63 sectors, 8802 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/emcpowerc1 1 7777 62468721 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.