Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I plugged in my brand new Transcend StoreJet 23H3 and bullishly went into cfdisk to recreate the partition table. I just want a Linux partition on it to perform incremental backups.

So, after making modifications, I ask cfdisk to write the partition table. It informs me that it is "Writing partition table to disk..." and hangs there for an hour. I know that partition tables don't take this long to write!

I decide to kill the process. Maybe the table will be corrupt, but something's wrong so what else can I do? But even kill -9 won't cut it:

root@flea:~# ps a | grep cfdisk
17512 pts/0    D+     0:00 cfdisk /dev/sdd
17608 pts/3    S+     0:00 grep cfdisk
root@flea:~# kill 17512
root@flea:~# ps a | grep cfdisk
17512 pts/0    D+     0:00 cfdisk /dev/sdd
17610 pts/3    S+     0:00 grep cfdisk
root@flea:~# kill -9 17512
root@flea:~# ps a | grep cfdisk
17512 pts/0    D+     0:00 cfdisk /dev/sdd
17612 pts/3    S+     0:00 grep cfdisk

I read that if I can't kill the process, it's probably stuck on some device I/O. Enter lsof:

root@flea:~# lsof -p 17512
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
cfdisk  17512 root  cwd    DIR    9,0     4096 55312385 /root
cfdisk  17512 root  rtd    DIR    9,0     4096        2 /
cfdisk  17512 root  txt    REG    9,0    64224 60293321 /sbin/cfdisk
cfdisk  17512 root  mem    REG    9,0    12404  9981520 /usr/lib64/gconv/ISO8859-1.so
cfdisk  17512 root  mem    REG    9,0    18996  7340293 /lib64/libdl-2.15.so
cfdisk  17512 root  mem    REG    9,0  2061170  7340292 /lib64/libc-2.15.so
cfdisk  17512 root  mem    REG    9,0    13920  7340106 /lib64/libuuid.so.1.3.0
cfdisk  17512 root  mem    REG    9,0   156648  7340129 /lib64/libblkid.so.1.1.0
cfdisk  17512 root  mem    REG    9,0   380096  7340049 /lib64/libncursesw.so.5.9
cfdisk  17512 root  mem    REG    9,0   167406  7340317 /lib64/ld-2.15.so
cfdisk  17512 root  mem    REG    9,0   221644 12977679 /usr/lib64/locale/en_US/LC_CTYPE
cfdisk  17512 root  mem    REG    9,0       59 12978040 /usr/lib64/locale/en_US/LC_NUMERIC
cfdisk  17512 root  mem    REG    9,0     2459 12978398 /usr/lib64/locale/en_US/LC_TIME
cfdisk  17512 root  mem    REG    9,0      291 12978273 /usr/lib64/locale/en_US/LC_MONETARY
cfdisk  17512 root  mem    REG    9,0       62 12978425 /usr/lib64/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES
cfdisk  17512 root  mem    REG    9,0       39 12978019 /usr/lib64/locale/en_US/LC_PAPER
cfdisk  17512 root  mem    REG    9,0       82 13118349 /usr/lib64/locale/en_US/LC_NAME
cfdisk  17512 root  mem    REG    9,0      160 12978427 /usr/lib64/locale/en_US/LC_ADDRESS
cfdisk  17512 root  mem    REG    9,0       64 12978393 /usr/lib64/locale/en_US/LC_TELEPHONE
cfdisk  17512 root  mem    REG    9,0       28 12978086 /usr/lib64/locale/en_US/LC_MEASUREMENT
cfdisk  17512 root  mem    REG    9,0      378 12978426 /usr/lib64/locale/en_US/LC_IDENTIFICATION
cfdisk  17512 root    0u   CHR  136,0      0t0        3 /dev/pts/0
cfdisk  17512 root    1u   CHR  136,0      0t0        3 /dev/pts/0
cfdisk  17512 root    2u   CHR  136,0      0t0        3 /dev/pts/0
cfdisk  17512 root    3u   BLK   8,48    0t512  8617489 /dev/sdd

I attached to the process with strace -p in a vain attempt to see if there's any syscalls bantering on in the background. Of course not. We're just stuck. Now I can't exit strace with Ctrl+C. I have to background it and use kill -9.

At this point, I'm grasping at straws. I unplug the USB drive, hoping that the block device will timeout and cfdisk will exit. Nope. Now the last result in lsof -p is:

cfdisk  17512 root    3u   BLK   8,48    0t512  8617489 /dev/sdd (deleted)

This seemingly innocuous task has now taken up a good portion of my morning. I don't want to reboot the system - it's running services for a number of people. It's also my last day at this company tomorrow, and I don't want to leave anything broken!

Any suggestions? =)

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.