Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is the situation.I installed the RHEL 5.5 on client's system and created LVM mount point at /u001/app/oracle and now he has installed DB on /u001/app/oracle. He is asked me to change the mount point of Existing LVM /u001/app/oracle to /u001/.

And preserve the directories /app/oracle in /u001/.

Problem is this if i change the mount point of LVM from /u001/app/oracle/ to /u001/ it will delete the directories /app/oracle and database will not be able to identify the NEW URL.

Now this is what i need

Change the mount point of /u001/app/oracle to /u001/ and preserve the /app/oracle/ directories (These two shouldn't be deleted after changing the mount point because these are the part of URL database is using)

Directory Structure

FileSystem                            Size     Used     Mounted on 
/dev/sda1                             100G     21G      /
/dev/mapper/VolGroup00-LogVol00       450G     83G      /u001/app/oracle
/dev/sda2                             487M     13M      /boot
share|improve this question
    
What part of that are you having trouble with? The second part of point 2. needs a bit more explaining or is irrelevant. (I really hope you've got good, valid backups that you know how to restore for that/those database(s).) –  Mat Dec 16 '12 at 9:03
    
in second part, Will the size of LVM after changing the Mount point of LVM /u001/app/oracle to /u001/ remains the same which is 450GB right now. –  OmiPenguin Dec 16 '12 at 9:13
    
And Do you know how to change the mount Point of LVM from /u001/app/oracle to /u001/ while keeping the directories /app/oracle in /u001/ intact –  OmiPenguin Dec 16 '12 at 9:20
    
Again, what problem do you have with that? It's just a matter of remounting & moving the stuff to the appropriate place afterwards. The shrinking the filesystem part is much more risky. Given that you can't seem to figure out the first part on your own, I'd really suggest you find a different way of doing all that (namely creating a new 200G filesystem and doing a simple copy to that & remount.) –  Mat Dec 16 '12 at 9:31
    
You didn't get it. There is a database on /u001/app/oracle and i can't move it so I have to keep it intact after remounting lvm from /u001/app/oracle/ to /u001/. Man just tell me how to do that. Waiting ..... –  OmiPenguin Dec 16 '12 at 9:35
show 3 more comments

1 Answer

up vote 2 down vote accepted

If you have a mount hierarchy like this:

/dev/hd1   /
/dev/hd2   /a/b/c

And want to change it to

/dev/hd1
/dev/hd2   /a

while preserving the structure of the /a directory as seen by applications, and assuming that /a and /a/b are otherwise empty, the transformation is simple:

  • stop the database (and everything that depends on it)
  • make sure you have a valid (restorable) backup of everything
  • take note of the permissions on directories /a, /a/b and /a/b/c
  • unmount /a/b/c
  • update your fstab (or whatever your OS uses) to reflect the new layour
  • mount /a

Then:

  • mkdir -p /a/b/c
  • restore the permissions on those directories as they were before
  • move everything in /a to /a/b/c (except b you just created obviously).

Example/simulation:

$ ls /u001/app/oracle
admin/
diag/
product/
...
# umount /u001/app/oracle
# <edit fstab>
# mount /u001
$ ls /u001
admin/
diag/
product/
...

At this point, your Oracle files are "re-rooted" at /u001. You just need to move them to the right hierarchy

# mkdir -p /u001/app/oracle
# check & adapt the permissions on those directories, making sure they
# are identical to what you had
$ mv /u001/* /u001/app/oracle
<warning about not moving app to a subdirectory of itself - ok>
# Don't forget the .dotfiles
$ mv /u001/.??* /u001/app/oracle
share|improve this answer
    
Sorry dear for very late reply from my part.I was out of the city. Ok i will test this soon and will let you know. Thanks man –  OmiPenguin Dec 18 '12 at 8:59
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.