Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|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

3 Answers 3

mv /example /vol

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

share|improve this answer

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
share|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
  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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.