-   Linux - Newbie (
-   -   moving file between partitions (

windycity_linux 08-21-2006 02:05 AM

moving file between partitions
how can i move files between partitions without impacting path associated with applications?

For example, lets say I have partition "x" which is full, I add another HD and want to move all files from partition "x" to partition "y". so how can this be done without changing the file path name in all applications.

I hope my question is clear. Many thanks for your help.

Tinkster 08-21-2006 02:24 AM

Clear enough. Has been asked (and done) lots of times.

All you need to do is to create a temporary mount-point.
Mount the empty partition to that. Copy the directory
structure you want to move there. Umount it. Create an
/etc/fstab entry for the partition with the directory-name
of where the files live. Mount it. If it all works, umount
it again, delete the directories content on the old file-system
(leave the directory as such alone). Re-mount the directory/partition.


zhangmaike 08-21-2006 02:31 AM

A warning: if copying files from one partition to another, be sure to tell cp to preserve the permissions and ownership with the -a option.

I've been helping someone else fix the permissions of a copy-gone-wrong (he only specified -R, so all files and directories had default permissions and were owned by root).

It's much easier to remember -a than it is to fix the problems which result from forgetting it.

windycity_linux 08-21-2006 02:11 PM

thanks all for your help

ramram29 08-21-2006 03:32 PM

I would recommend using LVM logical volume manager. With it you can add several disks to one logical partition. It's also a very good alternative for adding space to an already filled disk. If you have hot-swappable disks you can do this without even restarting Linux.

windycity_linux 08-22-2006 02:33 AM

I may be naive to say this but theoritically is it possible to do this with a soft link (ln -s) between the partition? Lets say I move the files to a new partition but create soft link between directories (old & new).

zhangmaike 08-22-2006 02:43 AM

Sure, it's possible. But it's WAY easier and more elegant to simply change the fstab entry. All you have to do is edit one line. Plus, if you ever move the files again, you won't have a handful of soft links to change. Just edit the same line.

Tinkster 08-22-2006 02:53 AM

You'll need to have a mount-point for the new partition somewhere...

It *should* be possible, but it's "unclean" :}


All times are GMT -5. The time now is 03:22 AM.