This happens on Toshiba laptop running Ubuntu_18.04_Server + LXDE and
Orange Pi Prime (arm64 architecture) using Armbian_5.59 (built on Debian_stretch_server + LXDE).

I have a 240 GB SSD drive attached via a USB-SATA cable.
It has a LUKS partition on it (sdb5, amongst others).
It has worked fine for a long time, but I was unaware that removing USB can cause problems:

$ lsblk
sda           8:0    0 465.8G  0 disk 
└─sda1        8:1    0 465.8G  0 part /home/dk/sda1
sdb           8:16   0 223.6G  0 disk 
├─sdb1        8:17   0  21.9G  0 part 
├─sdb2        8:18   0  23.4G  0 part 
├─sdb4        8:20   0     1K  0 part 
├─sdb5        8:21   0   165G  0 part 
└─sdb6        8:22   0   3.7G  0 part 
mmcblk0     179:0    0    29G  0 disk 
└─mmcblk0p1 179:1    0  28.7G  0 part /
zram0       254:0    0    50M  0 disk /var/log
zram1       254:1    0 250.3M  0 disk [SWAP]
zram2       254:2    0 250.3M  0 disk [SWAP]
zram3       254:3    0 250.3M  0 disk [SWAP]
zram4       254:4    0 250.3M  0 disk [SWAP]

"sudo cryptsetup luksOpen /dev/sdb5 sdb5-private" doesn't finish and doesn't create /dev/mapper/sdb5-private.

I want to scrap everything on sdb, and replace it with a single partition, but nothing will write to it.
1. gparted cannot open it (loops at start-up "scanning all partitions").
2. gnome-disk-utiliy can open it but Delete Partition loops without writing anything.
3. "parted /dev/sdb mktable msdos" loops without writing anything.
4. "dd if=/dev/zero of=/dev/sdb bs=512 count 1" and every other variety of options, doesn't seem to write anything.
5. "fdisk /dev/sdb":

$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): o
Created a new DOS disklabel with disk identifier 0xa4074931.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
/dev/sda: close device failed: Input/output error

Trying a few more features of fdisk I get:

$ sudo fdisk /dev/sdb
command: v
Total allocated sectors 498036738 greater than the maximum 468862128.

Er, the total actual sectors allocated seems to me to be 822,603,778 !

$ sudo if=/dev/zero of=/dev/sda  
writing to '/dev/sda1': Input/output error  
$ ls -al /dev/sda1  
brw-rw---- 1 root disk 8, 1 Oct 20 09:52 /dev/sda1".  

On non-existent sdb:

$ sudo dd if=/dev/zero of=/dev/sdb   
dd: writing to '/dev/sdb': No space left on device 
1913841+0 records in 1913840+0 records out
979886080 bytes (980 MB, 934 MiB) copied, 7.69708 s, 127 MB/s 

What could be wrong, and what other tools are available?

All these tools do not output any progress information or any useful error messages - very poor Linux products.

  • For example in gparted ... try to format at first without partition-table directly with e.g. ext4 fileformat. Then after this re-cognize the harddisk in menue left. Then try to create partition-table and after this - if successful - then format again with ext4 or whatever ... hope this helps. (You should probably hang out the LUKS partition (if there is a lock visible)). – dschinn1001 Oct 19 '18 at 3:30
  • Gparted > format on sda1 hangs and can't be killed. After reboot, /sda1 is still there. Same with gparted > delete. Can an SSD fail for writing? – Dave Kimble Oct 19 '18 at 6:50
  • Have you tried : sudo dd if=/dev/zero of=/dev/sda (or sda1)? perhaps wrong file permission? what is : ls -al /dev/sda1 telling ? SSD sure has warranty. Then swap it at trader. – dschinn1001 Oct 19 '18 at 10:52
  • The permissions on /dev/sdxn are all "brw-rw----", – Dave Kimble Oct 20 '18 at 0:02
  • Try in terminal this with your USB SSD - your SSD is /dev/sda? - then set permissions : sudo chmod 757 /dev/sda after this then : sudo dd if=/dev/zero of=/dev/sda - when finish then create partition table with sudo gparted and in the end format with a file-system. – dschinn1001 Oct 20 '18 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.