Saturday, August 21, 2010

War Story

Once in a while, we run into those pesky, irritating harddisk issues -- out of disk space on one partition, a few fat GBs of disk space on another partition.

Fortunately, there exist a cheap, simple, and neat trick to resolve such an issue on linux. The approach is as follows:

1. Perform the operations using root permissions.
$ su root

2. Do a recursive copy of the folder you want to copy.
Note that we use the -r flag for recrusive copy, and the --preserve flag to preserve important file attributes such as ownership and timestamp.
$ cp -r --preserve=all SOURCE TARGET

3. Delete the source folder

4. Create a symbolic link in place of the source folder.

No comments: