I would like to know how to mount a directory on a new partition or disk. I have a directory, example: /u01/app/mylab/data Inside this I have several files and directories, with specific permissions of other users and groups. This directory is short on space and so I presented the server with a new disk for the purpose of mounting /u01 (and all its subdirectories including permissions) on this new disk with enough space. I run mount /dev/sdb /u01 and when ready it doesn't show the content and I have to run umount /dev/sdb. Please, how can I do it?
Asked
Active
Viewed 1,270 times
1 Answers
0
First, temporarily mount your new disk to some temporary location, such as /mnt/temp. Next, copy the files from your /u01/app/mylab/data directory to /mnt/temp. Finally, unmount the /mnt/temp and then remount to /u01/app/mylab/data.
Or, in shell speak
mkdir /mnt/temp
mount /dev/sdb /mnt/temp
cp -pr /u01/app/mylab/data/ /mnt/temp
umount /mnt/temp
mount /dev/sdb /u01/app/mylab/data
Note that I did use cp
instead of mv
, as this way if something goes wrong during transfer, you won't end up with a corrupted situation. After you have verified everything works as it should, you can then umount the /dev/sdb one more time, free up the original space and then remount the /dev/sdb.

Janne Pikkarainen
- 31,852
- 4
- 58
- 81