I do a lot of work with virtual machine images. I ran in to a situation where I wanted to copy a file called System.img from one server to another and even though I knew I had enough room to do it, I would get messages stating that there was not enough space. What in the world was going on? The file system I wanted to copy the file to was 33G in size. The file was just under 33G in size. I knew it should fit. I knew this because the file system this file is coming from is also 33GB in size (same identical size). When it was all said and done I should of had about 150M of free space according to the source.
I tried FTP, SCP, and various other mechanisms to copy the file from the one server to the other. No joy.
So I copied the file to the destination server but to a different and larger file system. That obviously was successful, but I still wanted it on my 33G file system. So I tried copying the file locally from the larger file system to the 33G file system. No joy again... I got a message after a few minutes stating there was not enough space, and the process errored out.
I found a solution! Now, to be honest, I do not know why it works, but it does.
Assumptions: You are in the directory the System.img file is located. The file resides on the same server you are copying to. You have done the math and according to the calculator the file will fit on the destination file system.
Run this command with the appropriate path of your destination.
Note: The following command is all on one line.
# tar cvf - System.img | ( cd /destination file system/destination folder/;tar xvf - )
Works like a charm. I have used this little gem a dozen times in the past few months.
This should be obvious but... Remember, you can not copy/place a file that is larger than the space available on the destination. Hope this helps others out there.
Monday, February 15, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment