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 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT 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.