What is the easier way to move a directory to newly mounted drive

Example, if I have a directory called /example and mounted a new drive to /vol, how I can easily move /example to /vol

Since database data is stored in /example, if I copy the folder it might just get corrupted.

Thanks

link|improve this question
1  
Why would the data get corrupted exactly?? – Chris S Oct 26 '10 at 16:31
4  
Is this homework? – Chopper3 Oct 26 '10 at 16:36
feedback

3 Answers

mv /example /vol

(Works in Linux, BSDs, most Unix flavors, and Windows PowerShell)

link|improve this answer
feedback

Moving the data directory should be ok as long as the database is shut down before the move occurs.

Move all files in /example into /vol.

mv /example/* /vol

Move /example directory inside /vol.

mv /example/* /vol
link|improve this answer
1  
You've got the same command up there twice... – Chris S Oct 26 '10 at 16:39
His 2nd eg shouldn't have the /*. – Mark Wagner Oct 26 '10 at 17:23
feedback
  1. Shut down database (or any other service depending on /example)
  2. mv /example/* /vol/
  3. rm -rf /example
  4. Either reconfigure your database/applications to use /vol, or create a symlink with ln -s /vol /example
link|improve this answer
feedback

Your Answer

 
or
required, but never shown