Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using fdisk to resize the partitions on a raw QEMU image. When I write the new partition table, it hangs at "Syncing disks."

Note that I'm running fdisk as non-root since I don't need root to edit the image file.

What would cause "Syncing disks" to hang like this?

share|improve this question
    
Run strace -o fdisk.strace fdisk to see what it's hanging on. –  Gilles Feb 28 '12 at 23:54
    
It's dead now... I tried strace -p to attach to the process, but it hung, and I couldn't kill it either! –  Lorin Hochstein Feb 29 '12 at 3:55

1 Answer 1

up vote 2 down vote accepted

After printing the "Syncing disk" message, fdisk calls sync(2) syscall, which causes all buffered modifications to file metadata and data to be written to the underlying file systems. It is expected that this operation can take some time, but it shouldn't hang forever. If it does, you might see in which function in the kernel it hangs in /proc/FDISK_PID/stack.

The question is why fdisk calls sync() while working with the image file (not real device). It should not be needed IMHO.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.