While formatting a USB disk which was mounted in write-protected mode we are getting the below error:

fdisk: Unable to write /dev/sdg: Bad file descriptor

 

Solution

 

1. The disk in this example is /dev/sxx. Disable read-only mode on the USB disk first. Make sure hdparm is installed, then run the following command:

# hdparm -r0 /dev/sxx

 

2. Make sure the util-linux package is installed, and then wipe out the file system.

# wipefs --all /dev/sxx --force

 

3. Make a new parttion on the disk using fdisk:

# fdisk -cu /dev/sxx

 

then ‘d‘ to delete and ‘w‘ to write.

 

4. The disk is now ready to be formatted. To format the disk with the ext4 file system, the following command can be used:

# hdparm -r0 /dev/sxx

 

آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)