fdisk problem.
OS: linux centos 7
I used fdisk on a usb drive. It has hung and I haven't been able to kill it or get out of it.
As an additional problem, since then, in trying to remedy this problem, I physically removed other USB drives that showed up in /dev/. However, those still show in /dev/ even though are no longer physically attached.
Here is lsblk (I removed from this listing other devices that are listed)
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdf 8:80 0 1.8T 0 disk
└─sdf1 8:81 0 1.8T 0 part
sr0 11:0 1 1024M 0 rom
I made the choices below following the notes I made when a friend formatted another USB drive for me (same exact USB drive type). The intention is to format it as ext4.
Below is the set of choices (emboldened):
[root@linux18 ~]# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): **m**
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): **d**
Selected partition 1
Partition 1 is deleted
Command (m for help): **n**
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-3906963455, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3906963455, default 3906963455):
Using default value 3906963455
Partition 1 of type Linux and of size 1.8 TiB is set
Command (m for help): **t**
Selected partition 1
Hex code (type L to list all codes): 83
Changed type of partition 'Linux' to 'Linux'
Command (m for help): **w**
The partition table has been altered!
Here I tried both Control C and Control Z:
^[[B^[[B^[[B
^[[6~
^C^[[5~
Best Answer
This seem so be analogous to the problem you were facing: https://access.redhat.com/solutions/369623
Maybe try
# dmsetup remove
with some of the flag in the man page (--force --deferred --retry
)