2

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

3 Answers3

5

mv /example /vol

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

Chris S
  • 77,945
  • 11
  • 124
  • 216
2
  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
pauska
  • 19,620
  • 5
  • 57
  • 75
1

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

Files will be directly under /vol.


Move /example directory inside /vol:

mv /example/ /vol

Files will be under /vol/example.

Rohit Dodle
  • 103
  • 3
Declan Shanaghy
  • 211
  • 1
  • 5