Operating System - HP-UX
1833012 Members
2810 Online
110048 Solutions
New Discussion

Create a directory as separate file system

 
Dewa Negara_1
Advisor

Create a directory as separate file system

I have /oracle mounted under / file system. To overcome increasing size of / file system, I want to create /oracle as a separate file without missing any datas on it. What is the best way to do this? Anyone can help me on this. Thanks alot in advance.

[root@dev:/oracle]
# ll
total 48
drwxr-xr-x 5 oraa5p dba 8192 Jun 20 14:29 A5P
drwxr-xr-x 5 oraa6p dba 8192 Jun 20 14:02 A6P
drwxr-xr-x 5 oraa7p dba 8192 Jun 21 15:35 A7P

[root@dev:/oracle]
# bdf .
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lv_root 819200 312840 502432 38% /

[root@dev:/oracle]
# ll
total 48
drwxr-xr-x 5 oraa5p dba 8192 Jun 20 14:29 A5P
drwxr-xr-x 5 oraa6p dba 8192 Jun 20 14:02 A6P
drwxr-xr-x 5 oraa7p dba 8192 Jun 21 15:35 A7P
log all your daily activities on syslog.log every time...
6 REPLIES 6
Dewa Negara_1
Advisor

Re: Create a directory as separate file system

So sorry I was wrong type. I mean I want to create /oracle as a separate file system. Thanks alot.
log all your daily activities on syslog.log every time...
Peter Kloetgen
Esteemed Contributor

Re: Create a directory as separate file system

Hi Dewa,

you could use SAM for this:

--> disks and file systems
--> logical volumes
--> Actions menu, add (create)
--> select volume group
--> specify size, file system type, file system options (enable large files option!, give your mount point ( /oracle )

Everything else will be done by sam, he will create a logical volume, a mount point, a file system in the volume, an entry in /etc/fstab and he will mount the new file system.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Ralph Grothe
Honored Contributor

Re: Create a directory as separate file system

1. Create a new LV in a VG where you have still free PEs, or create a new VG if you have a new disk, and create an LV in this new LV (see man pvcreate, vgcreate, lvcreate)

2. Create a new filesystem on the raw (character) device of the newly created LV (see man newfs)

3. Bring down your Oracle DB (this is needed for transfer of data into new filesystem)

4. Temporarily mount new LV on any mountpoint (e.g. /cdrom)

5. When DB is down and has no open files in use, copy data to new filesystem
(e.g. assume mountpoint /cdrom:
cd /oracle
tar cf - . | (cd /cdrom; tar xpf -)
)

6. check that all data has been transferred
(e.g. bdf -i /cdrom /oracle)
look number of used inodes and size

7. Edit your /etc/fstab
and add line for new mount point of new LV

8. mount -a

9. Start DB, and run dbverify or run other checks
Madness, thy name is system administration
Stefan Farrelly
Honored Contributor

Re: Create a directory as separate file system


sure, easy. Use lvcreate to create new lvol to the size you want;

lvcreate -L vg00
newfs -F vxfs -o largefiles /dev/vg00/r

Add it to the /etc/fstab file
/dev/vg00/ /oracle vxfs delaylog 0 2

Temporarily mount it so you can copy all the current oracle stuff off to it;

mount /dev/vg00/ /tmp_mnt
cd /oracle
(you may need to ensure all your oracle dbs and listeners are down before doing the copy)
find . | cpio -pdmuxvl /tmp_mnt

now youve copied all your oracle stuff to your new lvol. Now you want to mount it as /oracle;

umount /tmp_mnt
mv /oracle /oracle.old
mkdir /oracle
chown oracle:dba /oracle
chmod 755 /oracle
mount -a (this will mount your new lvol to /oracle)

If everything now works aok you can remove the /oracle.old dir. The bdf command will show you its mounted.


Im from Palmerston North, New Zealand, but somehow ended up in London...
Dewa Negara_1
Advisor

Re: Create a directory as separate file system

Thanks alot for the information. Stefan, I have followed your steps. But after moving content of directory /oracle to /tmp/oracle (temporary mount point) using cpio, I got different size. Has all content of /oracle been moved to the /tmp/oracle? thanks.

[root@dev:/tmp/oracle]
# bdf .
Filesystem kbytes used avail %used Mounted on
/dev/vg_apps/lv_oracle
462848 232560 215899 52% /tmp/oracle

[root@dev:/tmp/oracle]
# cd /oracle

[root@dev:/oracle]
# ll
total 48
drwxr-xr-x 5 oraa5p dba 8192 Jun 20 14:29 A5P
drwxr-xr-x 5 oraa6p dba 8192 Jun 20 14:02 A6P
drwxr-xr-x 5 oraa7p dba 8192 Jun 21 15:35 A7P

[root@dev:/oracle]
# du -sk * A5P
87536 A5P
87528 A6P
87528 A7P
87536 A5P

[root@dev:/oracle]
# cd -
/tmp/oracle

[root@dev:/tmp/oracle]
# du -sk *
76447 A5P
76446 A6P
76446 A7P
log all your daily activities on syslog.log every time...
James R. Ferguson
Acclaimed Contributor

Re: Create a directory as separate file system

Hi:

The size reduction you see after copying your files to the new filesystem is often seen. I've used the procedure Stefan suggested many times.

As files are added to directories, the space required for inodes increases. If files are deleted, however, the space isn't recovered. When you recreate the directory, no extra space is needed and the result is a smaller directory.

Regards!

...JRF...