Moving a directory to another physical harddisk

Under my root file system in Ubuntu I have a directory called "Download". Unfortunately the physical hard disk where this directory is placed is now full. I mounted a new hard drive and formatted it with ext4 file system.

On this new hard drive I created a new directory called "Download" and moved all the content from the old "Download" directory to it. But now I wonder how I can make the Ubuntu system understand that the new "Download" directory is the directory to use.

Anyone ?
toyboy61Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gplanaCommented:
I would remove old Download folder, and create a link (with ln command) from Download folder in your main root file system to your other device Download folder.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rindiCommented:
Rename or delete the old Download Folder, then create a symlink in your home folder (where the old Download was) that points to the new location of the Download Folder.

If you google for "symlink" you should find enough details on how to create one. As I tend to forget the terminal commands I use the Midnight Commander filemanager to create symlinks, as it has that option built-in. But as MC isn't default in Linux distro's these days you'd have to install it using sudo apt-get install mc or via the GUI based package manager.
0
Garry GlendownConsulting and Network/Security SpecialistCommented:
rmdir /Download
ln -s /newhd/Download /Download

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

gplanaCommented:
Rindi and Garry-G: Thank you for extending my explanation.
0
arnoldCommented:
It depends on how you are managing the second drive. You could do as suggested.
Another options is that you can overlay a new partition on top of the one where you need the space.

i.e. instead of formating the new drive as a single partition.
You can split the drive into several logical partions using LVM.
Then you would copy the data you have
mount /dev/mapper/VolGroup* /mnt #mount the new partition temporarily
cd /Download #change to the directory from which you want the data copied
find . | cpio -pdvmu /mnt #copy the data note that should you have hard links to these files, they will have duplicate files
mv /Download /Download.orig
mkdir /Download
umount /mnt
mount /dev/mapper/VolGroup* /Download #adjust the /etc/fstab to make sure it comes up when the system boots.
chmod xxx /Download #to match the security settings on the /Download.orig

You're done.  This is also the method used if you need to increase size of an existing partition.

IMHO sym links may eventually lead to a point that you are on a treasure map trying to figure out what and where something really is.
0
toyboy61Author Commented:
@arnold: I tried to follow your advice, but I ran into problems:

"mount /dev/mapper/VolGroup* /mnt"
Error message: special device /dev/mapper/VolGroup* does not exist.

I'm running Ubuntu version 11.04 (64-bit if that's a point..).



0
arnoldCommented:
/dev/mapper/VolGroup* is supposed to represent the lvcreate <logical_volume_name> you created.

Could you post the commands you performed thus far.
i.e. you partitioned the new drive as a single linux partition without mkfs?
you then run pvcreate /dev/sdx where /dev/sdx is the new Volume presented to the system currently unallocated.
You then ran vgextend <an existing Volumegroup> /dev/sdx
or create a new VolumeGroup on the new drive
vgcreate Newvolgroup /dev/sdx
See
tldp.org/HOWTO/LVM-HOWTO/

Please post the output of the following commands

fdisk -l #display current storage devices and how they are partitioned

pvdisplay #display physical devices
vgdisplay #display Volume Groups
lvdisplay #display logical volumes
0
toyboy61Author Commented:
@arnold: Thanx.
I solved the problem by myself.

1) I copied the content of the "Download"-directory to the new physical hard-drive.
2) I removed the "Download"-directory from the old hard-drive.
3) I created a symlink to the new directory (quick and dirty..).
4) I updated the menu in Gnome 2 to point to the new "Download"-directory.

Then my problem is solved. But I will take your solution into account the next time I need to move a directory to a new physical hard-drive.

0
toyboy61Author Commented:
I did forget to mention that I also need to update Gnome 2 to point to the new directory. But I found out how to do that myself.. -)
0
rindiCommented:
Ubuntu doesn't use LVM as default normally (maybe the server version does, but I don't think so). So you wouldn't have LVM setup. You would have had to do that when setting up the system. Doing it later I'm not sure if that is easily possible.
0
toyboy61Author Commented:
@rindi: You're right. As far as I can see I have to download 'lvm' from the Ubuntu repository if I want it.. :-)
0
rindiCommented:
Downloading alone won't help, you have to setup the HD first using LVM, similar when using RAID, and then on top the VolumeGroups you create you put the file-system. Of course with a new HD you can use LVM to start with, but your original HD wouldn't be using that yet.

OS's like CentOS and others that are based on Red-Hat use LVM by default.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.