Operating System - Tru64 Unix
1752641 Members
5590 Online
108788 Solutions
New Discussion юеВ

Re: Moving a directory to a second local hard drive

 
SOLVED
Go to solution
Kaleung Tsou
Advisor

Moving a directory to a second local hard drive

I am a newbie running Tru64 5.1B

The problem I am having is my root disk is getting full because the previous person that setup the system created an essential SAP ( /sap_interface ) directory at root.

I installed a second local hdd with 72G of space. What is the best way to move the /sap_interface directory to the new hdd? Of course the files will still have to keep all permissions etc.

The new disk is /dev/disk/dsk8c

Thanks
10 REPLIES 10
Steven Schweda
Honored Contributor
Solution

Re: Moving a directory to a second local hard drive

Assuming AdvFS file systems, perhaps a
vdump+vrestore pipeline. Something like
this (untested):

( cd / ; vdump -D -f - sap_interface ) | \
( cd /destination ; vrestore -f - )

man vdump
man vrestore
Rob Leadbeater
Honored Contributor

Re: Moving a directory to a second local hard drive

Hi,

You don't say whether you've created a filesystem or file domain on the new disk... As you're new to Tru64, I guess probably not...

Therefore you'll need to do something like this (untested !):

# mkfdmn dsk8c sap_if
# mkfset sap_if sap_if
# mkdir /new_sap_interface
# mount sap_if#sap_if /new_sap_interface
# vdump -0f - /sap_interface | vrestore -xf - -D /new_sap_interface

Check that everything has copied cleanly betwen /sap_interface then /new_sap_interface. Then (presumably) shutdown SAP, to stop anything new being written to /sap_interface.

# rm -rf /sap_interface
# umount /new_sap_interface
# mount sap_if#sap_if /sap_interface

Modify /etc/fstab to add the new entry for /sap_interface

Hope this helps,

Regards,

Rob
Vladimir Fabecic
Honored Contributor

Re: Moving a directory to a second local hard drive

Maybe I did not understand well, but I think you need to move files from one directory which is located on / (root) file system, not on separated file system on system disk.
Am I right?
If so, try this:
1. Stop the database and make sure there are no oprn files in /sap_interface
2. Backup / file system with vdump (must be done to save you from mistake!)
3. Create advfs domain and file set (like Rob said) on new disk drive
4. Rename directory /sap_interface to something other, like /sap_interface_orig
# mv /sap_interface /sap_interface_orig
5. Create (new) directory /sap_interface
# mkdir /sap_interface
6. Mount file system from new disk drive to /sap_interface
# mount sap_if#sap_if /sap_interface
Make sure that this directory has same ownership and permitions like old one (chmod ; chown ; chgrp etc).
7. Copy files from "old" /sap_interface to "new" /sap_interface
# cd /sap_interface_orig
# cp -p -r . /sap_interface
This command should preserve permitions and ownership of files

Then try to start your database. If everything works OK, you can delete /sap_interface_orig

Please post if something is not clear.
In vino veritas, in VMS cluster
Kaleung Tsou
Advisor

Re: Moving a directory to a second local hard drive

Thanks for everyone for the reply. They are all useful information since I am a newbie.

It seems that I did not explain myself very well. I have some additional information that might help clarify my problem.

# df -k
Filesystem 1024-blocks Used Available Capacity Mounted on
root_domain#root 8198864 7485823 555880 94% /
usr_domain#usr 12392032 4808373 7319968 40% /usr
usr_domain#var 12392032 240958 7319968 4% /var
SAPexe#usrsap 17152320 3610526 13517024 22% /usr/sap
Oraclient#80464 11947392 24 11942552 1% /oracle/client/80x64
dda:/usr/sap/trans 36700160 19529906 17102336 54% /usr/sap/trans
grove:/pr_cart/nfs_prd 37748736 3992405 33756331 11% /nfs_vms
grove:/pr_cart/his_campus_prd 37748736 3992405 33756331 11% /usr/users/prdadm/his_campus

# ls
.TTauthority .new...profile UNTITLED install oracle sys
.Xauthority .osonly_tmp bin lib osf_boot tcb
.advfs_hostlist .profile cdrom logs pd.txt tmp
.cshrc .proto...cshrc cluster mdec proc usr
.dt .proto...login cslg.lic mnt quota.group var
.dtprofile .proto...profile cslgmar03unix.txt mnt1 quota.user vdumpOSfilesets
.dxlsm_pref .sh_history dev mountCD sap_interface vmunix
.local.. .ssh2 devices nfs_mounts sapmnt vmunix.PrePatch
.login .sysman df.txt nfs_vms sbin
.mrg...login .tags disks nohup.out scripts
.netscape GENERIC etc nsmail session.src
.new...cshrc NFS_VMS fsize nsr shlib
.new...login TT_DB genvmunix opt subsys

Correct me if I am wrong, It seems that /sap_interface is a directory in the / (root) file system. And move the /sap_interface directory to the new hard drive. Also, if I am creating the file system on the new hard drive, does the file domain and file system name matter on what I call it?

Also, what is the difference between vdump and vrestore compare to just copying files on Vladimir's method?

Thanks again!


Steven Schweda
Honored Contributor

Re: Moving a directory to a second local hard drive

> It seems that /sap_interface is a directory
> in the / (root) file system.

If it's not in the "df" output, then it seems
that way to me.

> [...] does the file domain and file system
> name matter on what I call it?

Not to me. I think that you can choose them.

> Also, what is the difference between vdump
> and vrestore compare to just copying files
> on Vladimir's method?

One may work much better than the other:

urtx# ls -li src
total 2
2343 -rw-r--r-- 2 root system 25 Jun 17 11:31 fred.lnh
2485 lrwxrwxrwx 1 root system 8 Jun 17 11:23 fred.lns -> fred.txt
2343 -rw-r--r-- 2 root system 25 Jun 17 11:31 fred.txt

(One hard link, one symbolic link, one file.)

urtx# cp -p -r src dst_cpr
urtx# ls -li dst_cpr
total 3
2473 -rw-r--r-- 1 root system 25 Jun 17 11:31 fred.lnh
2466 -rw-r--r-- 1 root system 25 Jun 17 11:31 fred.lns
2463 -rw-r--r-- 1 root system 25 Jun 17 11:31 fred.txt

(Three files, no links.)

urtx# mkdir dst_vdr
urtx# ( cd src ; vdump -D -f - . ) | ( cd dst_vdr ; vrestore -x -f - )

[Note that I forgot the "-x" in my original
("untested") example.]

path : .
dev/fset : root_domain#root
type : advfs
advfs id : 0x43dad8e0.00059d50.1
vdump: Date of last level 0 dump: the start of the epoch
vdump: Dumping directories
vdump: Dumping 33 bytes, 1 directories, 3 files
vdump: Dumping regular files

vdump: Status at Sun Jun 17 11:35:28 2007
vdump: Dumped 33 of 33 bytes; 100.0% completed
vdump: Dumped 1 of 1 directories; 100.0% completed
vdump: Dumped 3 of 3 files; 100.0% completed
vdump: Dump completed at Sun Jun 17 11:35:28 2007
vrestore: Date of the vdump save-set: Sun Jun 17 11:35:28 2007
vrestore: Save-set source directory : .
vrestore: Target directory : /dst_vdr
vrestore: WARNING: may have restored directory attributes, from archive onto tar
get directory.

urtx# ls -li dst_vdr
total 2
2470 -rw-r--r-- 2 root system 25 Jun 17 11:31 fred.lnh
2461 lrwxrwxrwx 1 root system 8 Jun 17 11:35 fred.lns -> fred.txt
2470 -rw-r--r-- 2 root system 25 Jun 17 11:31 fred.txt

(One hard link, one symbolic link, one file.)

Which result do you prefer? I like the
vdump-vrestore result better. (I normally
use a similar "tar" pipeline, but if you have
ACLs or some other OS-specific stuff in the
file system, then [v]dump-[v]restore (or
whatever the OS offers) is probably safer.)

I _never_ use "cp -r". Too many wrong
answers.
Kaleung Tsou
Advisor

Re: Moving a directory to a second local hard drive

Here is the outline on what I am going to do. Please let me know if it is correct.

Stop SAP

1. make file_domain on the new disk (name does not matter)

mkfdmn /dev/disk/dsk8c sap_ifd

2. make filesystem on the new disk


mkfset sap_ifd sap_if

3. Create new sap_interface directory and make the right permission is assigned

# mkdir /new_sap_interface

4. Mount the new sap_interface directory


# mount sap_ifd#sap_if /new_sap_interface

5. use vdump and vrestore to move files


# ( cd /sap_interface ; vdump -D -f - . ) | ( cd /new_sap_interface ; vrestore -x -f - )

6. rename the old sap_interface

mv /sap_interface /sap_interface_old

7. unmount /new_sap_interface

umount /new_sap_interface

8. rename /new_sap_interface to /sap_interface

9. mount sap_ifd#sap_if /sap_interface

10. start sap

Thanks again!
Steven Schweda
Honored Contributor

Re: Moving a directory to a second local hard drive

> Please let me know if it is correct.

I'm too lazy to check all this, but ...

You shouldn't need to stop SAP until you get
to step 5.

I would create a small test directory, say,
"/sap_dummy", with a few (small) files in it.
Then I would run the whole proposed procedure
on that test directory. If that works, then
delete everything in the new destination file
system, and then try the last part again,
using the real data.

Don't ask _me_ if the procedure works, ask
the procedure. (It's _much_ more reliable
than I am.)
Kaleung Tsou
Advisor

Re: Moving a directory to a second local hard drive

The procedure works. Thank you for everyone!
Kaleung Tsou
Advisor

Re: Moving a directory to a second local hard drive

Thanks everyone!