5

I ran mv a-folder /home/me on a machine and half way through the move the destination device filled up.

a-folder was made up of folders and files in various subdirectories.

Does mv leave the source folder intact until the move has successfully completed?

The source and destination folders were on different filesystems.

The reason I ask is that I ran this command on the wrong machine, so if the source folder is intact then that makes my life a lot easier :)

Rich
  • 4,529

2 Answers2

4

No your source folder is not intact... On the same file system all mv does is add and remove directory entries. But on a different filesystem... I'm not sure at what point it unlinks the file, and whether it removes data as it goes... but once a file is moved, it is unlinked.

This is unless of course you used a special option to mv. Some of which are mentioned in this question which might interest you in the future.

xenoterracide
  • 59,188
  • 74
  • 187
  • 252
4

xenoterracide's answer is 100% correct, I'll just add to it.

I often monitor the copy or move process of large amounts of files with:

watch -d -n 1 'du -sk dir1; du -sk dir2'

This will show you how the cumulated file size changes over time, proving to you that files are moved and removed (with mv) progressively along the way.

asoundmove
  • 2,495