- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- using find and tar to archive the last 12 hours
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:04 AM
тАО03-12-2003 07:04 AM
I haven't used tar in a while and I am a little rusty.
I need to know how to use find and tar to archive any files that have changed in the last 12 hours. I think it would go something like this.
find * -mtime +1 | tar -cvf /dev/rmt/0mn
Any help is greatly apprecitated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:09 AM
тАО03-12-2003 07:09 AM
Re: using find and tar to archive the last 12 hours
That would give you 24 hours. If you really want 12, try touching a file to give it the appropriate reference time and using the -newer option on your find.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:19 AM
тАО03-12-2003 07:19 AM
Re: using find and tar to archive the last 12 hours
Try the following:
touch -t 0303120300 /tmp/ref
find . -newer /tmp/ref -type f | xargs tar cvf /dev/rmt/0m
rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:20 AM
тАО03-12-2003 07:20 AM
Re: using find and tar to archive the last 12 hours
I can live with 24 hours.
My other question is can I create a tar ball across filesystems. OR do I need to done one for each seperate filesystem?
Here, is what I have. Don't be taken aback by the sizes. These are fairly static application filesystems.
# bdf|grep appl
/dev/vgappl/finapps
26419200 9320428 16834632 36% /appl/finapps
/dev/vgappl/stage 35225600 16884648 18197672 48% /appl/finapps/stage
/dev/vgappl/common 26419200 4792480 21288824 18% /appl/finapps/common
/dev/vgappl/archive
8806400 3230 8528078 0% /appl/finapps/archive
/dev/vgappl/appsdb 35225600 26866752 8293576 76% /appl/finapps/appsdb
/dev/vgappl/appsclnt
88064000 35085464 52564680 40% /appl/finapps/appsclnt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:32 AM
тАО03-12-2003 07:32 AM
Solutiontar -cvf test.tar `find . -type f -newer tfile`
the "tfile" is the file that was touched with the reference time.
good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:36 AM
тАО03-12-2003 07:36 AM
Re: using find and tar to archive the last 12 hours
Use tar in a pipeline to copy the entire file system hierarchy under
fromdir to todir:
cd fromdir ; tar cf - . | ( cd todir ; tar xf -i )
A variation on the above to find the files first should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:43 AM
тАО03-12-2003 07:43 AM
Re: using find and tar to archive the last 12 hours
I don't see an issue with having a tarball from across all those filesystems. As you've already said they're fairly static filesystems so there won't be much changed in the last 12 hours. If you are overly concerned though you can use -xdev with find to stop it crossing filesystems: just repeat for each filesystem with the appropriate path for find.
btw - I trust you are aware of tar's 2gb max limit per file - see the tar man page for info.
regards,
Darren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:52 AM
тАО03-12-2003 07:52 AM
Re: using find and tar to archive the last 12 hours
I think I will do 1 tarball if I can get them all in 12GB on a DDS3. I can't believe that it would be more than that for just the last 12 hours or even less. My backup completes around 2am usually.
Darren,
The 2GB file restriction is for "FILES" not for the TARball, right? hehe, it has been too long since I have used tar.
What will happen if TAR runs across a file that is larger than 2GB? Will it ignore the file? or fail the tar?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:58 AM
тАО03-12-2003 07:58 AM
Re: using find and tar to archive the last 12 hours
the restriction is on the files not the tarball. I'm not 100% sure of the result of including a greater than 2gig file in a tarball; to be safe I'd suggest you use the -size option of find to discover if you actually have any large files in that 12 hour period, then use -size in the actual find/tar command to ensure you don't back them up. Use another method on those files.
regards,
Darren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 07:59 AM
тАО03-12-2003 07:59 AM
Re: using find and tar to archive the last 12 hours
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 08:00 AM
тАО03-12-2003 08:00 AM
Re: using find and tar to archive the last 12 hours
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 08:07 AM
тАО03-12-2003 08:07 AM
Re: using find and tar to archive the last 12 hours
Thanks everyone for your input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 08:13 AM
тАО03-12-2003 08:13 AM
Re: using find and tar to archive the last 12 hours
I am using Netbackup for my regular backups. This is only a onetime backup for some activity that occurs after the incremental runs the night before.
We are doing this extra backup b/c we have some massive EMC work on the frame attached and are just making sure that we have CYA covered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2003 09:38 AM
тАО03-12-2003 09:38 AM
Re: using find and tar to archive the last 12 hours
#!/usr/bin/ksh
SDIR=/d166/oradata
DDIR=/d166b/oradata
if test -f $SDIR/nohup.out
then
rm $SDIR/nohup.out
fi
if test $DDIR
then
cd $SDIR
/usr/local/bin/tar cvf - . |(cd $DDIR;/usr/local/bin/tar xvfp -)
fi
The /usr/local/bin version of tar is gnu tar, from the HP porting people. We have to use this because our .dbf files are HUGE. We have a different script for each mount point--this allows us to run all 8 at the same time. Of course, this kills the CPU's, but who cares? The database is down at this point.
Of course, this doesn't use find to locate the files, this just copies off the whole filesystem. To include find, just below the cd $SDIR line, write:
for FILE in `find . -mtime 1`
do
tar cvf - $FILE|(cd $DDIR;/usr/local/bin/tar xvfp -)
done
This will move the whole directory tree, not just create a tarball.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-23-2003 12:47 PM
тАО06-23-2003 12:47 PM
Re: using find and tar to archive the last 12 hours
I backed up only those files that were modified since my backup the night before. i used the touch command to create a file for the tar to run and compare the files against.