Do I have to unmount the drive when using dd command?

Solution 1:

It's possible (checked in this moment) but it's highly advisable to umount the device before a dd.


This may be not a problem in your special case if=/dev/urandom, but in other cases:

If is some activity on that partition during the dd command, there is no guarantee that you partition isn't broken.

Solution 2:

You should boot into a Live USB and unmount the disk you are trying to erase. If you absolutely must, you can try remounting the root filesystem as read-only using Alt+SysRQ+u, then use dd if=/dev/zero of=/dev/sdX where /dev/sdX is your disk. You really should consider using a Live USB though, since it is MUCH safer.