USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Technical issues/questions of an intermediate or advanced nature.
Post Reply
User avatar
Rava
Contributor
Contributor
Posts: 2843
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc2 x86-64 XFCe
Location: Forests of Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#1 by Rava » 12 Jan 2021, 16:50

mkfs.ext2: Input/output error while writing out and closing file system is not something one wants to hear.
My manual attempt using fdisk and mkfs.ext2:

Code: Select all

root@porteus:/# fdisk -l /dev/sdd
Disk /dev/sdd: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root@porteus:/# fdisk /dev/sdd

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

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xc24adb2a.

Command (m for help): p
Disk /dev/sdd: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xjaddajadda

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-30310399, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-30310399, default 30310399): 
 
Created a new partition 1 of type 'Linux' and of size 14.5 GiB.

Command (m for help): p
Disk /dev/sdd: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc24adb2a

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdd1        2048 30310399 30308352 14.5G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@porteus:/# mkfs.ext2 /dev/sdd1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 3788544 4k blocks and 948416 inodes
Filesystem UUID: b07a7ef5-93fc-4419-8a22-1ac6a2241696
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: mkfs.ext2: Input/output error while writing out and closing file system
gparted has similar issues, so here the GUI attempt

Code: Select all

Device:	/dev/sdd
Model:	Intenso Alu Line
Serial:	
Sector size:	512
Total sectors:	30310400
 
Heads:	255
Sectors/track:	2
Cylinders:	59432
 
Partition table:	msdos
 
Partition	Type	Start	End	Flags	Partition Name	File System	Label	Mount Point
/dev/sdd1	Primary	2048	30310399			unknown		

========================================
Format /dev/sdd1 as ext2  00:01:10    ( ERROR )
     	
calibrate /dev/sdd1  00:00:00    ( SUCCESS )
     	
path: /dev/sdd1 (partition)
start: 2048
end: 30310399
size: 30308352 (14.45 GiB)
clear old file system signatures in /dev/sdd1  00:00:10    ( SUCCESS )
     	
write 512.00 KiB of zeros at byte offset 0  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 67108864  00:00:00    ( SUCCESS )
write 512.00 KiB of zeros at byte offset 15517351936  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 15517810688  00:00:00    ( SUCCESS )
write 8.00 KiB of zeros at byte offset 15517868032  00:00:00    ( SUCCESS )
flush operating system cache of /dev/sdd  00:00:09    ( SUCCESS )
     	
libparted messages    ( INFO )
     	
Input/output error during write on /dev/sdd
set partition type on /dev/sdd1  00:01:00    ( SUCCESS )
     	
new partition type: ext2
libparted messages    ( INFO )
     	
Input/output error during write on /dev/sdd
create new ext2 file system  00:00:00    ( ERROR )
     	
mkfs.ext2 -F -L '' '/dev/sdd1'  00:00:00    ( ERROR )
     	
mke2fs 1.45.6 (20-Mar-2020)
/dev/sdd1: Read-only file system while setting up superblock
Read-only file system while previous operations have been successful?

What can be done to make the thumb drive useable? Using Linux tool, no Witless-OS currently available.

It was like this from the start, and silly me misplaced the receipt and I bought it when 16 GB (or more like 14.45 GB - 15518924800 can never be counted as 16 GB - even when using 1000x1000 units instead of 1024x1024) sticks have been much more expansive than they are now. :crazy:
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 5877
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 & 5.0rc2 Cinnamon 64 ISOs
Location: Western NY, USA

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#2 by Ed_P » 12 Jan 2021, 17:25

Can you try a different format? FAT for example.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 2843
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc2 x86-64 XFCe
Location: Forests of Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#3 by Rava » 12 Jan 2021, 18:32

Silly me forgot adding that failed attempts in the past used Type b aka 'W95 FAT32'. Everyone would always try FAT32 first, then maybe ext2 later.

So here what the fail looks like using FAT32

Code: Select all

root@porteus:/# fdisk /dev/sde

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


Command (m for help): p
Disk /dev/sde: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xblablubb

Device     Boot Start      End  Sectors  Size Id Type
/dev/sde1        2048 30310399 30308352 14.5G 83 Linux

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): b
Changed type of partition 'Linux' to 'W95 FAT32'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@porteus:/# mkfs.vfat -F 32 /dev/sde1
mkfs.fat 4.1 (2017-01-24)
mkfs.vfat: unable to open /dev/sde1: Read-only file system
root@porteus:/# mkfs.fat -F 32 /dev/sde1
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: unable to open /dev/sde1: Read-only file system

Seems mkfs.fat fails as much as mkfs.ext2 .

Removing and reinserting…

Code: Select all

Jan 12 19:17:47 porteus kernel: [288680.283166] usb 2-1.2.2: USB disconnect, device number 66
Jan 12 19:17:51 porteus kernel: [288683.931930] usb 2-1.2.2: new high-speed USB device number 67 using ehci-pci
Jan 12 19:17:51 porteus kernel: [288683.955855] usb 2-1.2.2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.0b
Jan 12 19:17:51 porteus kernel: [288683.955863] usb 2-1.2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 12 19:17:51 porteus kernel: [288683.955869] usb 2-1.2.2: Product: Intenso Alu Line
Jan 12 19:17:51 porteus kernel: [288683.955874] usb 2-1.2.2: Manufacturer: Alcor Tech
Jan 12 19:17:51 porteus kernel: [288683.955879] usb 2-1.2.2: SerialNumber: 13082800005231
Jan 12 19:17:51 porteus kernel: [288683.956499] usb-storage 2-1.2.2:1.0: USB Mass Storage device detected
Jan 12 19:17:51 porteus kernel: [288683.956893] scsi host9: usb-storage 2-1.2.2:1.0
Jan 12 19:17:51 porteus mtp-probe: checking bus 2, device 67: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.2" 
Jan 12 19:17:51 porteus mtp-probe: bus: 2, device: 67 was not an MTP device 
Jan 12 19:17:52 porteus kernel: [288684.996421] scsi 9:0:0:0: Direct-Access     Intenso  Alu Line         8.07 PQ: 0 ANSI: 4
Jan 12 19:17:52 porteus kernel: [288684.998457] sd 9:0:0:0: [sde] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
Jan 12 19:17:52 porteus kernel: [288684.999682] sd 9:0:0:0: [sde] Write Protect is off
Jan 12 19:17:52 porteus kernel: [288685.000940] sd 9:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Jan 12 19:17:53 porteus kernel: [288685.616114] sd 9:0:0:0: [sde] Attached SCSI removable disk

/var/log/messages lines 810-821/821 (END)
See the

Code: Select all

[sde] Write Protect is off
line?

Next try…

Code: Select all

root@porteus:/# fdisk -l /dev/sde
Disk /dev/sde: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
As you can see, all previous fdisk changes are nil.

Code: Select all

root@porteus:/# fdisk  /dev/sde

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

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xbad505ca.

Command (m for help): p
Disk /dev/sde: 14.45 GiB, 15518924800 bytes, 30310400 sectors
Disk model: Alu Line        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbad505ca

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-30310399, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-30310399, default 30310399): 
 
Created a new partition 1 of type 'Linux' and of size 14.5 GiB.

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): b
Changed type of partition 'Linux' to 'W95 FAT32'.

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

LOL at the newest disk identifier 0xbad - bad indeed.
Cheers!
Yours Rava

donald
Full of knowledge
Full of knowledge
Posts: 1734
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#4 by donald » 13 Jan 2021, 02:00

I would dd the whole drive
dd if=/dev/zero of=/dev/sdX bs=1M
If no errors occur, format the drive using GParted.

Cheap fake from ebay?

beny
Full of knowledge
Full of knowledge
Posts: 940
Joined: 02 Jan 2011, 11:33
Location: italy

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#5 by beny » 13 Jan 2021, 02:27

hi donald,also sandisk cruzer 128 giga with an arch on, read only system and no cheap fake sandisk tell us is read only system to preserve data inside but you can't read the key so....trashcan

Kulle
Shogun
Shogun
Posts: 263
Joined: 28 Jan 2017, 10:39
Distribution: v4.0 64bit Xfce
Location: Berlin

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#6 by Kulle » 13 Jan 2021, 08:56

Hi Rava,
mkfs.vfat: unable to open /dev/sde1: Read-only file system
I also had this mistake once

Remedy:
On Windows with diskpart.exe:

list disk
select disk ...
Be careful, dial the correct number!!
attributes disk clear readonly
clean

And further (if you want to format a partition with fat32)
create partition primary
active
format fs=fat32 label="..." quick override
exit

User avatar
Rava
Contributor
Contributor
Posts: 2843
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc2 x86-64 XFCe
Location: Forests of Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#7 by Rava » 13 Jan 2021, 23:01

Kulle wrote:
13 Jan 2021, 08:56
Hi Rava,
mkfs.vfat: unable to open /dev/sde1: Read-only file system
I also had this mistake once

Remedy:
On Windows with diskpart.exe:
unfortunately, like I wrote above: currently no windoze available.
donald wrote:
13 Jan 2021, 02:00
I would dd the whole drive
dd if=/dev/zero of=/dev/sdX bs=1M
If no errors occur, format the drive using GParted.

Cheap fake from ebay?
neither cheap nor from ebay.

Code: Select all

Jan 13 09:32:01 porteus kernel: [339934.278726] usb 2-1.2.1: USB disconnect, device number 85
Jan 13 09:32:11 porteus kernel: [339943.883879] usb 2-1.3: new high-speed USB device number 86 using ehci-pci
Jan 13 09:32:11 porteus kernel: [339943.907695] usb 2-1.3: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.0b
Jan 13 09:32:11 porteus kernel: [339943.907703] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 13 09:32:11 porteus kernel: [339943.907707] usb 2-1.3: Product: Intenso Alu Line
Jan 13 09:32:11 porteus kernel: [339943.907711] usb 2-1.3: Manufacturer: Alcor Tech
Jan 13 09:32:11 porteus kernel: [339943.907714] usb 2-1.3: SerialNumber: 13082800005231
Jan 13 09:32:11 porteus kernel: [339943.908304] usb-storage 2-1.3:1.0: USB Mass Storage device detected
Jan 13 09:32:11 porteus kernel: [339943.908739] scsi host8: usb-storage 2-1.3:1.0
Jan 13 09:32:11 porteus mtp-probe: checking bus 2, device 86: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3" 
Jan 13 09:32:11 porteus mtp-probe: bus: 2, device: 86 was not an MTP device 
Jan 13 09:32:12 porteus kernel: [339944.963321] scsi 8:0:0:0: Direct-Access     Intenso  Alu Line         8.07 PQ: 0 ANSI: 4
Jan 13 09:32:12 porteus kernel: [339944.965476] sd 8:0:0:0: [sdd] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
Jan 13 09:32:12 porteus kernel: [339944.966654] sd 8:0:0:0: [sdd] Write Protect is off
Jan 13 09:32:12 porteus kernel: [339944.967863] sd 8:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Jan 13 09:32:12 porteus kernel: [339944.977037] sd 8:0:0:0: [sdd] Write Protect is on
Jan 13 09:32:12 porteus kernel: [339944.978662] sd 8:0:0:0: [sdd] Attached SCSI removable disk
/var/log/messages lines 2119-2160/2160 (END)
sdd it is.

but soon after

Code: Select all

Jan 13 09:32:12 porteus kernel: [339944.966654] sd 8:0:0:0: [sdd] Write Protect is off
there is

Code: Select all

Jan 13 09:32:12 porteus kernel: [339944.977037] sd 8:0:0:0: [sdd] Write Protect is on
how does one disable Write Protect?
I only know of the remount rw option of mount, but we are far from the goal to mount the stick. How to change from Write Protect is on to Write Protect is off on an external non-mountable device?

Code: Select all

root@porteus:/# fdisk /dev/sdd

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

fdisk: cannot open /dev/sdd: Read-only file system
root@porteus:/# sfdisk  /dev/sdd
sfdisk: cannot open /dev/sdd: Read-only file system
root@porteus:/# cfdisk  /dev/sdd
cfdisk: cannot open /dev/sdd: Read-only file system
fdisk --help nor sfdisk --help nor cfdisk --help give info on switching off write protect.

For now, dd sure fails even writing even a single bit:

Code: Select all

root@porteus:/# time dd if=/dev/zero of=/dev/sdd bs=1M;echo $?
dd: failed to open '/dev/sdd': Read-only file system

real	0m0.008s
user	0m0.005s
sys	0m0.003s
1
root@porteus:/# 
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 940
Joined: 02 Jan 2011, 11:33
Location: italy

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#8 by beny » 13 Jan 2021, 23:34

from ubuntu forum,i do not have usb key damaged so.....

To turn off disk device`s write protect, we use the low level system utility hdparm like this:

sudo hdparm -r0 /dev/sdb

where we asume that /dev/sdb is the Physical disk device we're working on. If the device has partitions that are mounted as read-only, you should re-mount 'em as read-write in order to write data to them.

Hope that helps.

User avatar
Rava
Contributor
Contributor
Posts: 2843
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc2 x86-64 XFCe
Location: Forests of Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#9 by Rava » 14 Jan 2021, 03:12

beny wrote:
13 Jan 2021, 23:34
Hope that helps.
Unfortunately, no. :( Image

Code: Select all

Jan 14 03:42:02 porteus kernel: [397072.295871] usb 2-1.2.1: new high-speed USB device number 113 using ehci-pci
Jan 14 03:42:02 porteus kernel: [397072.321002] usb 2-1.2.1: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.0b
Jan 14 03:42:02 porteus kernel: [397072.321008] usb 2-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 14 03:42:02 porteus kernel: [397072.321013] usb 2-1.2.1: Product: Intenso Alu Line
Jan 14 03:42:02 porteus kernel: [397072.321016] usb 2-1.2.1: Manufacturer: Alcor Tech
Jan 14 03:42:02 porteus kernel: [397072.321019] usb 2-1.2.1: SerialNumber: […]
Jan 14 03:42:02 porteus kernel: [397072.321571] usb-storage 2-1.2.1:1.0: USB Mass Storage device detected
Jan 14 03:42:02 porteus kernel: [397072.322562] scsi host8: usb-storage 2-1.2.1:1.0
Jan 14 03:42:02 porteus mtp-probe: checking bus 2, device 113: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.1" 
Jan 14 03:42:02 porteus mtp-probe: bus: 2, device: 113 was not an MTP device 
Jan 14 03:42:03 porteus kernel: [397073.347511] scsi 8:0:0:0: Direct-Access     Intenso  Alu Line         8.07 PQ: 0 ANSI: 4
Jan 14 03:42:03 porteus kernel: [397073.349491] sd 8:0:0:0: [sdc] 30310400 512-byte logical blocks: (15.5 GB/14.5 GiB)
Jan 14 03:42:03 porteus kernel: [397073.350828] sd 8:0:0:0: [sdc] Write Protect is off
Jan 14 03:42:03 porteus kernel: [397073.352879] sd 8:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Jan 14 03:42:03 porteus kernel: [397073.362613] sd 8:0:0:0: [sdc] Write Protect is on
Jan 14 03:42:03 porteus kernel: [397073.363942] sd 8:0:0:0: [sdc] Attached SCSI removable disk
so, sdc it is.

Code: Select all

root@porteus:/# hdparm -r0 /dev/sdc

/dev/sdc:
 setting readonly to 0 (off)
 readonly      =  0 (off)
root@porteus:/# fdisk  /dev/sdc

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

fdisk: cannot open /dev/sdc: Read-only file system
root@porteus:/# hdparm -r0 /dev/sdc

/dev/sdc:
 setting readonly to 0 (off)
 readonly      =  0 (off)
root@porteus:/# time dd if=/dev/zero of=/dev/sdc bs=1M;echo $?
dd: failed to open '/dev/sdc': Read-only file system

real	0m0.006s
user	0m0.003s
sys	0m0.003s
1
root@porteus:/# 
Seems hdparm has no effect. :cry:
There is no report in /var/log/messages about
sd 8:0:0:0: [sdc] Write Protect is off
either…
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 2843
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 5.0rc2 x86-64 XFCe
Location: Forests of Germany

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#10 by Rava » 14 Jan 2021, 21:10

Update
Tried hdparm also on my 32 bit system running Porteus 4.0 - with the very same results.
Maybe booting Knoppix might help?

Does anyone has the porteus.cfg cheatcode to successfully boot the newest Knoppix DVD - from Nov 2020 when I recall right - copied as iso onto an USB stick?

Tried looking for that info on the official Knoppix forum to no prevail. :(
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 5877
Joined: 06 Feb 2013, 22:12
Distribution: 4.0 & 5.0rc2 Cinnamon 64 ISOs
Location: Western NY, USA

USB thumbdrive - mkfs.ext2: Input/output error while writing out and closing file system

Post#11 by Ed_P » 14 Jan 2021, 23:28

The hard part in booting an ISO is finding the parm it uses to boot the ISO. Possible ISO boot parms I have found are: boot=/, from=all, from=$iso, fromiso=$iso, findiso=$iso, iso-scan/filename=$iso, bootfrom=/dev/sda6$iso Where $iso has been set to the name of the ISO to be booted. Root should be set to the location of the ISO with a search command.
Ed

Post Reply