Mar/093
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, it rather 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/sda2) 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:
- Linux: Remove installed RPM packages manually
- Linux: Cannot turn on a virtual machine after unclean shutdown – failed to lock the file error VMware Server
- 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: Copy files between Linux Servers with scp
- Debian: Etch x64 and VMware Server Cannot connect to host x.x.x.x: No connection could be made because the target machine actively refused it.
Enjoy this article?
Leave a comment
No trackbacks yet.
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.