Mar/098
Linux: Cannot move folders – inter-device move failed, unable to remove target: Is a directory
This is somewhat simple as long as we understand the concept. mv or move does not actually move the file/folder to another location within the same device, it merely replaces the pointer in the first sector of your device. The pointer (in inode table) will be moved, but nothing is actually being copied. This will work as long as you stay within the same media/device.
Now, when you try to move files from one device to another (/dev/sda1 to /dev/sdb1) you will run into “inter-device move failed, unable to remove target: Is a directory” error. This happens when mv has to actually move your data to another device, but cannot remove the inode/pointer, because if it did then there will be no data to fall back to, and if it didn’t then mv operation is not really complete because we will end up with data in source. Damned if you do and damned if you don’t, so it’s wise not to do it to begin with!
In such situation cp is best. Copy your data over and then remove your source manually.
Related posts:
- VMware – Linux: OS cannot mount /dev/sd* after a virtual machine is converted – Waiting for device /dev/sd* to appear… not found – fall back
- Linux: Cannot turn on a virtual machine after unclean shutdown – failed to lock the file error VMware Server
- Linux: Remove installed RPM packages manually

12:30 PM on June 6th, 2009
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042810 GranParadiso/3.0.10
Ohh.. this is really new to me!
I used Linux every day the last 5 years, I almost have a MS in Computer Science but I never faced this peculiar behavior of mv.
Life is a never-ending lesson.
Thanks for sharing this.
12:34 PM on June 6th, 2009
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Exactly! I just ran into this one recently myself!
4:28 PM on June 9th, 2009
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10
I have scripts using mv I received that same error and added the -b [backup] flag. Works much better now. I hope this helps someone.
4:32 PM on July 22nd, 2011
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.124 Safari/534.30
Actually sda1 and sda2 implies that both are partitions of the same disk, so that would not cause this problem
10:00 AM on July 29th, 2011
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Good point. Changed – thanks.
4:30 AM on November 15th, 2011
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.04 Chromium/14.0.835.202 Chrome/14.0.835.202 Safari/535.1
I’ve met this problem for the first time after 10+ years of everyday using Linux. Strange thing – it appeared on only one of moved directories. “mv -b” works of course but it takes much more time and sources.
10:56 AM on January 24th, 2012
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7
Make’s sense, although the error message could be a bit more descriptive.