Operating System - HP-UX
1837897 Members
3196 Online
110123 Solutions
New Discussion

Re: A filesystem is full!

 
ajk_2
Advisor

A filesystem is full!

Hi all,

I discovered a filesystem is almost full!

1. Now I want to copy files (older then 3 months) to another HP unix server's filesystem, then I will delete the files in the full filesystem.

or

2. ftp files (older than 3 months) to my PC, then I will delete the files in the full filesystem.

Would you tell me how I can write a script for that? Thanks!



Regards
ajk
12 REPLIES 12
harry d brown jr
Honored Contributor

Re: A filesystem is full!



A few questions first. How many megs does the file system have available, because a file system at 99% can still have 1GB of available space, it just depends upon the size of that filesystem. Also, when you say files that are 3 months old, do you mean files that have not been accessed in three months, or files that have not been updated in three months?

The "find" command do do either. "-atime" for "time last accessed", and "-mtime" for "date last modified".

To copy to another hpux machine using ftp? Why not write the files to tape or use rcp?

Have you tried to identify the large files causing this issue?

cd (to the directory in question)

then

find . -type f -size +1000000 -exec ls -l {} \;

will find any files over 1MB.



live free or die
harry
Live Free or Die
Michael Tully
Honored Contributor

Re: A filesystem is full!

Hi,

If your are not sure what files you
wish to copy why not set up and NFS
mount point on the destination server.

Have you tried to compress the files
using compress or gzip first? Using
tools like this gain good compression
for flat files.

Another good way is gzip the files into
either tar or cpio and then store them
onto your other server.

gzip | tar cvf -

Michael
Anyone for a Mutiny ?
Darrell Allen
Honored Contributor

Re: A filesystem is full!

Here's some things you may consider.

cd /directory
find . -mtime +90 -print >/tmp/list
for file in `cat /tmp/list`
do
rcp -p $file remote_host:/directory
done

After you verify the files were written on the remote system:
cd /directory
for file in `cat /tmp/list`
do
rm $file
done

As an alternative, you could create an archive file, gzip it, transfer it to the remote system, then extract it there. Of perhaps you could create a tape. Either way, I'd verify the files were actually written on the remote system before deleting them from the local system.

You could even use NFS to mount a remote filesystem then simply copy the files.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
ajk_2
Advisor

Re: A filesystem is full!

Hi Darrell,

I did try "rcp -p $file remote_host:/directory"
but it has an error "remshd: Login incorrect."
What happen?
Thanks!

ajk
Vijeesh CTK
Trusted Contributor

Re: A filesystem is full!


hi ,

u have to make necessary entries in ur .rhosts file in the target machine...

Vijeesh CTK
Justo Exposito
Esteemed Contributor

Re: A filesystem is full!

Hi,

You need an .rhosts file in the home directory for the user, this file must have this structure:

machinename user

This is in order to use the rcp, rlogin and much more commands.

Regards,

Justo.
Help is a Beatiful word
Trond Haugen
Honored Contributor

Re: A filesystem is full!

In addition to what is already mentioned do remember to check for core files.
find . -name core -exec rm -f {} \;
Actually that will remove them, but you could replace rm with ll.

Trond
Regards,
Trond Haugen
LinkedIn
ajk_2
Advisor

Re: A filesystem is full!

Hi,

Now I am using the Darrell's procedure and I did the .rhosts. However, it caused an error
"rcp: cat: No such file or directory". Do you guys know what happen? Thanks

ajk
Steven Sim Kok Leong
Honored Contributor

Re: A filesystem is full!

Hi,

In your script, check your PATH settings. The cat command resides in /usr/bin. If your PATH does not comprise the cat command, the following statement in your script will fail:

for file in `cat /tmp/list`

You can either update your PATH variable or you can simply change the statement to:

for file in `/usr/bin/cat /tmp/list`

Hope this helps. Regards.

Steven Sim Kok Leong
Steven Sim Kok Leong
Honored Contributor

Re: A filesystem is full!

Hi,

The error could also probably be due to a non-existent /tmp/list.

Check that this file exists before cat executes on it.

Hope this helps. Regards.

Steven Sim Kok Leong
ajk_2
Advisor

Re: A filesystem is full!

I did try this way:

for NAME in $(cat /tmp/list)
>do
>rcp $NAME remote_host:/directory
>done

It works!
Do you know what the difference between NAME and FILE? Thanks!

Regards
ajk
Steven Sim Kok Leong
Honored Contributor

Re: A filesystem is full!

Hi,

No difference.

Both NAME and file are just variable names. You can define any name you want and reference them later using the $ dollar sign.

Hope this helps. Regards.

Steven Sim Kok Leong