# secondhand hdd - cannot remove/create partitions.

## NightwalkerPL

Hi,

I buy secondhanded hdd, cfdisk says:

```
                                  cfdisk 2.12r

                              Disk Drive: /dev/hdb

                       Size: 122942324736 bytes, 122.9 GB

             Heads: 255   Sectors per Track: 63   Cylinders: 14946

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)

 ------------------------------------------------------------------------------

]   hdb1        Boot        Primary   NTFS             [              118213.73 

    hdb5                    Logical   NTFS                              4721.32
```

When i try to remove all partitions, and click "Write", and then restart cfdisk partitions are still the same (as above).

Fdisk too can't delete this.

What i should to do?

Thanks and sorry for my bad english.

----------

## Sadako

Are you absolutely sure the partitions aren't mounted or some process is accessing them (hal are something similar)?

Try clearing the mbr with dd, but I'd advise making a backup first, just in case.

Backup;

```
dd if=/dev/hdb of=hdbmbr bs=512 count=1
```

Clear;

```
dd if=/dev/zero of=/dev/hdb bs=512 count=1
```

That should do the trick.

----------

## whig

Default kernels can require a reboot for the system to re-read the tables. fdisk states if this is necessary.

----------

## NightwalkerPL

Hopeless: this not solved my problem  :Sad: 

I try to do reboot few times.

----------

## timeBandit

That's extremely odd...there's almost no way dd could have failed to erase the partition table. Did it give any errors?

Please forgive me for asking, but you are logged in as root when trying to edit the partition table, aren't you?

Are you able to mount and read the existing partitions? What's the output of this series of commands?

```
ls /mnt

mount /dev/hdb1 /mnt

ls /mnt

umount /mnt

mount /dev/hdb5 /mnt

ls /mnt

umount /mnt
```

----------

## NightwalkerPL

I've put this hdd to my home desktop, and still nothing  :Sad: 

I tried on Gentoo and Debian Etch.

The drive isn't mounted, and i run all commands from root (i'am not so dumb...)

```
[01:09] nightwalker ~ $ sudo su

bastard nightwalker # cd

bastard ~ # dd if=/dev/zero of=/dev/hdb bs=512 count=1

1+0 records in

1+0 records out

512 bytes (512 B) copied, 0.0229412 s, 22.3 kB/s

bastard ~ # fdisk -l /dev/hdb

Disk /dev/hdb: 122.9 GB, 122942324736 bytes

255 heads, 63 sectors/track, 14946 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/hdb1   *           1       14372   115443058+   7  HPFS/NTFS

/dev/hdb2           14373       14946     4610655    f  W95 Ext'd (LBA)

/dev/hdb5           14373       14946     4610623+   7  HPFS/NTFS

bastard ~ # fdisk /dev/hdb

The number of cylinders for this disk is set to 14946.

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-5): 1

Command (m for help): d

Partition number (1-5): 2

Command (m for help): p

Disk /dev/hdb: 122.9 GB, 122942324736 bytes

255 heads, 63 sectors/track, 14946 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): write

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

REBOOT HERE

bastard ~ # fdisk -l /dev/hdb

Disk /dev/hdb: 122.9 GB, 122942324736 bytes

255 heads, 63 sectors/track, 14946 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/hdb1   *           1       14372   115443058+   7  HPFS/NTFS

/dev/hdb2           14373       14946     4610655    f  W95 Ext'd (LBA)

/dev/hdb5           14373       14946     4610623+   7  HPFS/NTFS
```

//EDIT

```
(parted) print                                                           

Model: Maxtor 6Y120L0 (ide)

Disk /dev/hdb: 123GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start  End    Size    Type      File system  Flags

1      32.3kB  118GB  118GB  primary  ntfs        boot

2      118GB  123GB  4721MB  extended              lba 

5      118GB  123GB  4721MB  logical  ntfs
```

But this disk have only 122GB, i think this is because of this.

----------

## eccerr0r

I've never experimented with the "write protect boot block" option in bios, do you have that turned on in your firmware?  The partition table is pretty close to the boot block, so I suppose it may be "protected" (then again, I'm not sure how BIOS can protect against this...)

just some babbling...

----------

## kernelOfTruth

try to delete those partitions @ a friend with m$winblows    :Laughing: 

joke byside: have you tried gparted / or other livecd, if you have at hand: a win installation cd?

----------

## Roman_Gruber

hi

try gparted, its in portage.

----------

