Hi Reader
How to using tar for multiple archive files on a tape ?
How to using mt ?
I am using
tar tvf /dev/rmt/2n *.d
UNIX version
SunOS 5.6 , sun4u sparc SUNW,Ultra-4
I am using
tar tvf /dev/rmt/2n *.d
UNIX version
SunOS 5.6 , sun4u sparc SUNW,Ultra-4
> I am using
> tar tvf /dev/rmt/2n *.d
--
Chris F.A. Johnson | Author:
<http://cfaj.freeshell.org> | Shell Scripting Recipes:
Any code in this post is released | A Problem-Solution Approach,
under the GNU General Public Licence | 2005, Apress
I need monthly backup *.d into one single tape. How to do ?
> > I am using
> > tar tvf /dev/rmt/2n *.d
> for file in *.d
> do
> tar tvf "$file"
> done
> --
> Chris F.A. Johnson | Author:
> <http://cfaj.freeshell.org> | Shell Scripting Recipes:
> Any code in this post is released | A Problem-Solution Approach,
> under the GNU General Public Licence | 2005, Apress
>I need monthly backup *.d into one single tape. How to do ?
>> > Hi Reader
>> > How to using tar for multiple archive files on a tape ?
>> > How to using mt ?
>> > I am using
>> > tar tvf /dev/rmt/2n *.d
>> for file in *.d
>> do
>> tar tvf "$file"
>> done
The generalized answer is "learn about the non-rewind tape option on
your operating system." Whatever operating system that is, as you
haven't told us. For that matter, you haven't told us what *.d refers to,
in the context of "multiple archive files".
carl
--
carl lowenstein marine physical lab u.c. san diego
> >I need monthly backup *.d into one single tape. How to do ?
> >> > Hi Reader
> >> > How to using tar for multiple archive files on a tape ?
> >> > How to using mt ?
> >> > I am using
> >> > tar tvf /dev/rmt/2n *.d
> >> for file in *.d
> >> do
> >> tar tvf "$file"
> >> done
> Given that "tvf" should read "cvf" in most of the lines above,
> I don't see how this answer is relevant to the OP's problem.
You (the OP) are using a non-rewinding tape device, /dev/rmt/2n, but
the trick is to use dd rather than tar to actually write to the tape.
So, adapting Chris's answer:
for file in *.d
do
tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
done
Note the quotation marks round "$file" (and maybe "$directory" would be
a better name, or use something meaningful with respect to your application).
Check your documentation for the 63k block size.
At the end, of course, you do want to rewind the tape so:
mt -f /dev/rmt/2 rewind
for file in *.d
do
tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
done
sleep 3
mt -f /dev/rmt/2 rewoffl
The sleep 3 may not be needed but at least does no harm; rewoffl rewinds
the tape and takes the drive offline so no other process will inadvertantly
write over your tape (use rewind if you'd rather keep the drive online).
On that note, you might consider checking that only one of these processes
runs at a time.
You might also consider printing a list of the files/directories backed up
(and the date) and a copy of the script and storing them with the tape.
It will make life easier when you need to restore a particular directory
in eigh* months time.
--
John.
>> >Sorry.Typo error.
>> >tar tvf /dev/rmt/2n *.d should be tar cvf /dev/rmt/2n *.d
>> >I need monthly backup *.d into one single tape. How to do ?
>> >> > Hi Reader
>> >> > How to using tar for multiple archive files on a tape ?
>> >> > How to using mt ?
>> >> > I am using
>> >> > tar tvf /dev/rmt/2n *.d
>> >> for file in *.d
>> >> do
>> >> tar tvf "$file"
>> >> done
>> Given that "tvf" should read "cvf" in most of the lines above,
>> I don't see how this answer is relevant to the OP's problem.
> Chris answered the original question before the OP changed it from
> tar tvf to tar cvf. You'd think with all his book royalties, he could
> afford a better crystal ball but there we are.
> You (the OP) are using a non-rewinding tape device, /dev/rmt/2n, but
> the trick is to use dd rather than tar to actually write to the tape.
> So, adapting Chris's answer:
> for file in *.d
> do
> tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
> done
I guess he does not want to to create one tarfile for each file/dir
object *.d, but wind the tape to the end of written data, add one
tar file to it, and rewind the tape and unload it and place it in the
vault.
I really suggest the OP read man mt carefully. I have some vage,
remote memories of words like "file marks", but I fear I would be
talking nonsense if I tried to rely on those memories.
On the other hand, I cannot understand what good dd will do here.
Tar was invented for exactly what the OP is doing, writing to tape.
I would
# space to end of data. At end of data, there are *two*
# consecutive file marks. Elsewhere there is just one
# filemark between each file on the tape.
mt -f /dev/rmt/2n eod
# space back over the last file mark
mt -f /dev/rmt/2n bsf 1
# :) :) :)
tar cf /dev/rmt/2n *.d
# (but after exactly 3.1415 months the tape runs full...)
# Otherwise the file is terminated with two filemarks and the system
# automatically rewinds positioning between the two marks.
# If another file is written to the tape now, the second filemark is
# overwritten with the new file. If not, the tape ends in two
# filemarks as before.
# rewind and eject
mt -f /dev/rmt/2n offline
Very good point.Quote:> Note the quotation marks round "$file" (and maybe "$directory" would be
> a better name, or use something meaningful with respect to your application).
> Check your documentation for the 63k block size.
> At the end, of course, you do want to rewind the tape so:
> mt -f /dev/rmt/2 rewind
> for file in *.d
> do
> tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
> done
> sleep 3
> mt -f /dev/rmt/2 rewoffl
> The sleep 3 may not be needed but at least does no harm; rewoffl rewinds
> the tape and takes the drive offline so no other process will inadvertantly
> write over your tape (use rewind if you'd rather keep the drive online).
> On that note, you might consider checking that only one of these processes
> runs at a time.
> You might also consider printing a list of the files/directories backed up
> (and the date) and a copy of the script and storing them with the tape.
> It will make life easier when you need to restore a particular directory
> in eigh* months time.
or
-Enrique
> >> >Sorry.Typo error.
> >> >tar tvf /dev/rmt/2n *.d should be tar cvf /dev/rmt/2n *.d
> >> >I need monthly backup *.d into one single tape. How to do ?
> >> >> > Hi Reader
> >> >> > How to using tar for multiple archive files on a tape ?
> >> >> > How to using mt ?
> >> >> > I am using
> >> >> > tar tvf /dev/rmt/2n *.d
> >> >> for file in *.d
> >> >> do
> >> >> tar tvf "$file"
> >> >> done
> >> Given that "tvf" should read "cvf" in most of the lines above,
> >> I don't see how this answer is relevant to the OP's problem.
> > Chris answered the original question before the OP changed it from
> > tar tvf to tar cvf. You'd think with all his book royalties, he could
> > afford a better crystal ball but there we are.
> > You (the OP) are using a non-rewinding tape device, /dev/rmt/2n, but
> > the trick is to use dd rather than tar to actually write to the tape.
> > So, adapting Chris's answer:
> > for file in *.d
> > do
> > tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
> > done
> But what if the OP wants to append this month's tarfile to a tape that
> has been in the vault in the mean time?
> I guess he does not want to to create one tarfile for each file/dir
> object *.d, but wind the tape to the end of written data, add one
> tar file to it, and rewind the tape and unload it and place it in the
> vault.
> I really suggest the OP read man mt carefully. I have some vage,
> remote memories of words like "file marks", but I fear I would be
> talking nonsense if I tried to rely on those memories.
> On the other hand, I cannot understand what good dd will do here.
> Tar was invented for exactly what the OP is doing, writing to tape.
Here one natural solution might be tar cf non-rewinding-device *.d
but the OP is already using that so presumably wants something else.
As you say, it may well be to skip past old tar files before adding a new
one to the same tape that has been rewound at some point.
As is often the case, it is not quite clear what is the OP's real problem
(and maybe comp.unix.solaris would be a better place to ask).
--
John.
> > >> >I need monthly backup *.d into one single tape. How to do ?
> > >> >> > Hi Reader
> > >> >> > How to using tar for multiple archive files on a tape ?
> > >> >> > How to using mt ?
> > >> >> > I am using
> > >> >> > tar tvf /dev/rmt/2n *.d
> > >> >> for file in *.d
> > >> >> do
> > >> >> tar tvf "$file"
> > >> >> done
> > >> Given that "tvf" should read "cvf" in most of the lines above,
> > >> I don't see how this answer is relevant to the OP's problem.
> > > Chris answered the original question before the OP changed it from
> > > tar tvf to tar cvf. You'd think with all his book royalties, he could
> > > afford a better crystal ball but there we are.
> > > You (the OP) are using a non-rewinding tape device, /dev/rmt/2n, but
> > > the trick is to use dd rather than tar to actually write to the tape.
> > > So, adapting Chris's answer:
> > > for file in *.d
> > > do
> > > tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
> > > done
> > But what if the OP wants to append this month's tarfile to a tape that
> > has been in the vault in the mean time?
> > I guess he does not want to to create one tarfile for each file/dir
> > object *.d, but wind the tape to the end of written data, add one
> > tar file to it, and rewind the tape and unload it and place it in the
> > vault.
> > I really suggest the OP read man mt carefully. I have some vage,
> > remote memories of words like "file marks", but I fear I would be
> > talking nonsense if I tried to rely on those memories.
> > On the other hand, I cannot understand what good dd will do here.
> > Tar was invented for exactly what the OP is doing, writing to tape.
> In this case, yes. If the OP wished perhaps to change source directories
> then it is easier to use dd to write to the tape. Tbh, I've been using dd
> for so long I can't remember why but there may have been issues with
> early Solaris tar and block sizes or remote tape drives. The OP uses
> Solaris 2.6.
> Here one natural solution might be tar cf non-rewinding-device *.d
> but the OP is already using that so presumably wants something else.
> As you say, it may well be to skip past old tar files before adding a new
> one to the same tape that has been rewound at some point.
> As is often the case, it is not quite clear what is the OP's real problem
> (and maybe comp.unix.solaris would be a better place to ask).
> --
> John.
Monthly, I need Backup *.d into one tape
Below is testing tar into file. using tar rvf. I want below result
# tar cvf abc.tar .profile
a .profile 4K
# tar tvf abc.tar
tar: blocksize = 10
-rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
# tar rvf abc.tar .profile
a .profile 4K
# tar rvf abc.tar .profile
a .profile 4K
#tar tvf abc.tar
-rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
-rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
-rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
#
> > > On Tue, 01 Nov 2005 07:57:26 +0100, John L
> > > >> >Sorry.Typo error.
> > > >> >tar tvf /dev/rmt/2n *.d should be tar cvf /dev/rmt/2n *.d
> > > >> >I need monthly backup *.d into one single tape. How to do ?
> > > >> >> > Hi Reader
> > > >> >> > How to using tar for multiple archive files on a tape ?
> > > >> >> > How to using mt ?
> > > >> >> > I am using
> > > >> >> > tar tvf /dev/rmt/2n *.d
> > > >> >> for file in *.d
> > > >> >> do
> > > >> >> tar tvf "$file"
> > > >> >> done
> > > >> Given that "tvf" should read "cvf" in most of the lines above,
> > > >> I don't see how this answer is relevant to the OP's problem.
> > > > Chris answered the original question before the OP changed it from
> > > > tar tvf to tar cvf. You'd think with all his book royalties, he could
> > > > afford a better crystal ball but there we are.
> > > > You (the OP) are using a non-rewinding tape device, /dev/rmt/2n, but
> > > > the trick is to use dd rather than tar to actually write to the tape.
> > > > So, adapting Chris's answer:
> > > > for file in *.d
> > > > do
> > > > tar cf - "$file" | dd of=/dev/rmt/2n obs=63k
> > > > done
> > > But what if the OP wants to append this month's tarfile to a tape that
> > > has been in the vault in the mean time?
> > > I guess he does not want to to create one tarfile for each file/dir
> > > object *.d, but wind the tape to the end of written data, add one
> > > tar file to it, and rewind the tape and unload it and place it in the
> > > vault.
> > > I really suggest the OP read man mt carefully. I have some vage,
> > > remote memories of words like "file marks", but I fear I would be
> > > talking nonsense if I tried to rely on those memories.
> > > On the other hand, I cannot understand what good dd will do here.
> > > Tar was invented for exactly what the OP is doing, writing to tape.
> > In this case, yes. If the OP wished perhaps to change source directories
> > then it is easier to use dd to write to the tape. Tbh, I've been using dd
> > for so long I can't remember why but there may have been issues with
> > early Solaris tar and block sizes or remote tape drives. The OP uses
> > Solaris 2.6.
> > Here one natural solution might be tar cf non-rewinding-device *.d
> > but the OP is already using that so presumably wants something else.
> > As you say, it may well be to skip past old tar files before adding a new
> > one to the same tape that has been rewound at some point.
> > As is often the case, it is not quite clear what is the OP's real problem
> > (and maybe comp.unix.solaris would be a better place to ask).
> support .profile should be *.d ( just for testing) , the file name is
> yymm_xxxx.d
> Monthly, I need Backup *.d into one tape
> Below is testing tar into file. using tar rvf. I want below result
> # tar cvf abc.tar .profile
> a .profile 4K
> # tar tvf abc.tar
> tar: blocksize = 10
> -rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
> # tar rvf abc.tar .profile
> a .profile 4K
> # tar rvf abc.tar .profile
> a .profile 4K
> #tar tvf abc.tar
> -rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
> -rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
> -rwxrwxrwx 1003/1 3331 Oct 31 11:42 2005 .profile
> #
If you are saying that you have a single tape, and that once a month
you wish to archive *.d to the end of the tape without over-writing
any previous months' archives, then you can use mt to skip to the end
of the tape as Enrique Perez-Terron explained.
It might be easier, safer and far cheaper to burn a new CD each month.
--
John.
1. backup multiple tar-files on a tape using tar and mt - command
How can I backup multiple tar-files on a tape using mt and tar and how
can I restore them ???
I am working on a netserver under solaris 2.4
thanks for help !!
3. backup multiple tar-files on a tape using tar & mt ???
5. using tar to store multiple compressed files to tape
7. Can't find multiple archives on a tar tape
9. Creating multiple tar archives on 8mm tape???
10. multiple tar archives on a remote tape.
11. multiple tar archives on one tape
12. tar, cmtp, mt, EOF, EOM and multiple tape archives...
13. ---use tar to generate multiple archives on a tape