0

I want to wipe a dual boot hard disk. I strongly suspect this disk is partly NTFS and partly ext4 because I think those are the defaults for Windows and Ubuntu, respectively.

Windows was installed first, then Ubuntu. This disk was set-up without partition re-sizing. That means I installed Windows on a partition that occupied 50% of the disk. Then I installed Ubuntu (and grub) on the other 50%. This probably means the Windows partitions (the big one and the little extra one that Windows creates) are probably NTFS. I think the Ubuntu partition would be ext4 by default and the Ubuntu swap partition is simply never formatted.

The command issued was

shred -vzn 2 /dev/sdb

Given that there are two kinds of formatting on this physical, I wasn't surprised to see these errors:

shred: /dev/sdb: error writing at offset 31207811072: Input/output error
shred: /dev/sdb: error writing at offset 31207811584: Input/output error
shred: /dev/sdb: error writing at offset 31207812096: Input/output error

There are thousands of these error messages.

Does this mean the shredding was not effective?

muru
  • 197,895
  • 55
  • 485
  • 740
H2ONaCl
  • 9,693
  • What is the output of cat /proc/swaps? Just wondering if swap space from that drive is being used. – 0x01 Mar 16 '18 at 10:14
  • The device was shutdown properly whether it was Ubuntu or Windows that was last running so the swap space would not have been used in the sense of saving a hibernation state. As to whether it existed, I believe that recent Ubuntu's like 16.04 create a swap space by default. – H2ONaCl Mar 17 '18 at 04:51
  • Given how shred works, I really don't see how having multiple partitions matters at all. Those errors must be due to something else. – Andrea Lazzarotto Mar 17 '18 at 11:28

2 Answers2

0

It means that your disk is faulty. Grab one of the LiveCDs with S.M.A.R.T. tools included and do a extended / full S.M.A.R.T. scan (warning: this can take hours!) - you could also use a standard Ubuntu LiveCD and use the "Disks" utility for that and/or install the necessary S.M.A.R.T. components on the live system.

Check for errors. You're likely to have some. If you do, and if you still have warranty on the drive, then return it to the manufacturer for replacement.

P.S.: Or the reason is that you're trying to wipe the drive with the system that is installed on it. That won't work. Use a live system, boot from USB.

0x01
  • 269
  • 1
  • 8
  • No I'm trying to wipe an external (/dev/sdb). The computer itself is running on /dev/sda. – H2ONaCl Mar 16 '18 at 09:48
  • Then you can skip the part of the Live system. Follow https://askubuntu.com/questions/528072/how-can-i-check-the-smart-status-of-a-ssd-or-hdd-on-current-versions-of-ubuntu-1 rsp. the first answer and do an extended test of the HDD. – 0x01 Mar 16 '18 at 10:13
  • Wiping via dd seemed to work so it probably is not a faulty device. I did get one error message at the end probably due to the large block I was writing. In other words, the physical size divided by the write block was not an integer. I am doing it again with a smaller block (but still a multiple of 512) and if there is no error then likely all is well. – H2ONaCl Mar 17 '18 at 00:39
0

Eventually, I used the following solution.

First use lsblk to note the devices present. Then attach the drive intended to be wiped. Then use lsblk again to note the drive that is now present that was not present before. Suppose it is sdX and then the following applies. Change sdX to whatever applies in your case.

sudo dd if=/dev/urandom of=/dev/sdX bs=64K

Eventually it will indicate an out-of-space writing condition and the dd process will exit. I don't know if the out-of-space message can be avoided. Since /dev/urandom will never return an end-of-file, it seems not.

H2ONaCl
  • 9,693