cmd:rar 

Usage 

rar a -v7m -y ~+1/XunQingJi `ls`
# ? -rr2p ?
rare -kb The.Truth.part01.rar

— -kb Keep broken extracted files

Hist 
$ rar a -rr2p -v7m -y ~+1/XunQingJi .
Adding    ./XunQingJi_xun06.asf

— the file is not in sequence

Help File 

/opt/doc/rar.txt

Source 

http://www.rarlab.com/download.htm Only have the lastest version

Related Urls 

http://www.rararchiver.com/download.html Have some extra unrar tools for different platforms or tools.

http://www.rar.cz/rar_download_cnt.html Most comprehensive. Have all histories, and even RAR Password Cracker!

Installation 

cd ~/try
chmod a+x /home/tong/dl/mustH_b/va/rarlnx28.sfx
/home/tong/dl/mustH_b/va/rarlnx28.sfx

— will extract to current dir

cd rar
% make PREFIX=/opt
cp rar unrar /opt/bin
cp rarfiles.lst /etc
cp default.sfx dos.sfx /opt/lib
cp rar.txt /opt/doc/
mv RARREG.KEY ~/

Test Run 

Small files 
4736 Sep  1 22:27 jot-4.3-1.rar       ; with -p
4758 Sep  1 22:26 jot-4.3.rar         ; with -p
4473 Sep  1 22:28 jot-4.3.tgz         ; plain tgz
Large files 
 543296 Jul  1 18:12 bin.tz3
 952208 Jul  1 18:12 u.tz3
 952208 Jul  1 18:12 txtHist.tz3
 950424 Jul 10 03:45 bin.rar
1881848 Jul 10 03:49 txtHist.rar
1005471 Nov 11 00:40 bin.rar
 753466 Nov  6 21:59 bin.tgz
 581408 Nov 10 22:17 bin.tz2
 561696 Nov  4 21:43 bin.tz3

So

multi-volumes + data recovery record 
$ rar a -rr2p -v7m -y ~+1/XunQingJi `ls`
Creating archive /mnt/tmp/tmp/XunQingJi.rar
Adding    XunQingJi_xun01.asf
Adding data recovery record
Creating archive /mnt/tmp/tmp/XunQingJi.part002.rar
...       XunQingJi_xun01.asf
Adding data recovery record
-rw-rw----    1 tong     tong      7340032 Dec 31 18:40 XunQingJi.part001.rar
-rw-rw----    1 tong     tong      7218216 Dec 31 18:40 XunQingJi.rar
$ calc 7218216 / 1024 / 1024
6.88383
$ calc 7340032 / 1024 / 1024
7
$ calc '(7340032 - 7218216) / 7340032 * 100'
1.65961

Error recovery 

Strategy 

If unreliable media is a concern (especially CDROM media), use the build in recovery mechanism in rar. There are two ways to do it. 1) rr[N], adding data recovery record, and 2) rv[N], creating recovery volumes.

My experiences with bad CDROM media definitely suggest that recovery-volume is super. I used to copy the whole rars onto hard disk before extracting them. This has several benefits over extracting right from CDROM. The key issue is to save CDROM. After copying over to HD, I can checksum, list, extract, re-extract, etc. That is, read CDROM once and I can do all sorts of operations on them.

There are draw backs adding data recovery record. When reading errors occurs in CDROM, Unix cp reports "Input/output error", then refuses to do further reading, which cause the file to be truncated. Rar cannot handle this.

Example 

File size info 
-r--r--r--    1 tong     tong      2097152 Jan 23 00:02 briefcase.part03.rev
-r--r-----    1 tong     tong      1708032 Jan 23 11:12 briefcase.part04.rar
-r--r--r--    1 tong     tong      2097152 Jan 23 00:02 briefcase.part04.rev
[...]
-r--r--r--    1 tong     tong      2097152 Jan 23 00:02 briefcase.part16.rar
-r--r-----    1 tong     tong        98304 Jan 23 11:11 briefcase.part17.rar
-r--r--r--    1 tong     tong      2097152 Jan 23 00:02 briefcase.part18.rar
[...]
-r--r--r--    1 tong     tong      2097152 Jan 23 00:02 briefcase.part23.rar
-r--r-----    1 tong     tong       798720 Jan 23 11:11 briefcase.part24.rar
Check sum info 
./briefcase.part04.rar  2097152 Size=1708032    Failed!
...............
./briefcase.part17.rar  2097152 Size=98304      Failed!
.......
./briefcase.part24.rar  1133335 Size=798720     Failed!
Tip !!
Extracting from briefcase-200301230003/briefcase.part03.rar
...         j2sdk-1_4_0_01-linux-i586.bin
Extracting from briefcase-200301230003/briefcase.part04.rar
...         j2sdk-1_4_0_01-linux-i586.bin
j2sdk-1_4_0_01-linux-i586.bin - CRC failed
Unexpected end of archive
Extracting from briefcase-200301230003/briefcase.part05.rar
Extracting  j2sdk-1_4_0_01-linux-i586.bin
j2sdk-1_4_0_01-linux-i586.bin - CRC failed
[...]
Extracting from briefcase-200301230003/briefcase.part17.rar
Extracting  j2sdk-1_4_0_01-linux-i586.bin
j2sdk-1_4_0_01-linux-i586.bin - CRC failed
Unexpected end of archive
Extracting from briefcase-200301230003/briefcase.part18.rar
Extracting  j2sdk-1_4_0_01-linux-i586.bin
j2sdk-1_4_0_01-linux-i586.bin - CRC failed
Extracting from briefcase-200301230003/briefcase.part19.rar
Extracting  j2sdk-1_4_0_01-linux-i586.bin
j2sdk-1_4_0_01-linux-i586.bin - CRC failed
Extracting  canada-stamp1.jpg                                         OK
Extracting  d4x-2.4.0rc1-1.i386.rpm                                   OK
Extracting  linux-506.tar.gz

Conclusion 

The above example shows that one failed volume part04.rar will cause the next 15 good volumes to fail.

In conclusion, the method of adding recovery record to archive is strongly recommended against to be used.

Whereas for creating recovery volumes, each recovery volume is able to reconstruct one missing or damaged RAR volume. More over, you are able to reconstruct any missing volumes provided that the number of .rev files exceeds the number of missing volumes.

There is however a limitation in the number of usual and recovery volumes, the sum must not exceed 255. This does impose a great trouble when archiving multi-disk, multi-volume CDROM archives.

rar a -v2k -y rart BUGS_INF.MP3

— result from rart.part0001.rar to rart.part2339.rar, no volume number limit

rar a -rv300 -v8k -y rart BUGS_INF.MP3
$ dir rart.part*.rev
-rw-rw----    1 tong     tong         8192 Jan 26 14:59 rart.part001.rev

— only 1 recovery volume is created, if the usual volume number exceeds 255

rar a -rv300 -v20k -y rart BUGS_INF.MP3
$ ls rart.part*.rar | wc -l
    226
$ ls rart.part*.rev | wc -l
     29

— total is exactly 255!

How useful can adding recovery record be 

Let's try to extract the above broken medias directly from CDROM, and see what we got. Previously I have to remove all those broken rars before I can extract them normally.

Extracting from /mnt/cdrom/briefcase-200301230003/briefcase.part04.rar
...         j2sdk-1_4_0_01-linux-i586.bin
Read error in the file /mnt/cdrom/briefcase-200301230003/briefcase.part04.rar [R]etry, [A]bort a
Read error in the file /mnt/cdrom/briefcase-200301230003/briefcase.part04.rar
Program aborted

Ha, Error recovery like this is totally useless. Ah, the rar way is to repair archive first, using the -r command: the damaged archive is searched for a recovery record (see 'rr' command). If the archive contains a recovery record and if the portion of the damaged data is continuous and less than N*512 bytes, where N is number of recovery sectors placed into the archive, the chance of successful archive reconstruction is very high. When this stage has completed, a new archive will be created, called fixed.arcname.rar, where 'arcname' is the original (damaged) archive name.

To summarize, adding recovery record is still totally useless in CDROM backup case: you can't repair them (due to the read only media) and you can't extract them either.

Help 

Quick Help 

Usage:     rar <command> -<switch 1> -<switch N> <archive> <files...>
              <@listfiles...> <path_to_extract\>
<Commands>
 a             Add files to archive
 c             Add archive comment
 cf            Add files comment
 cw            Write archive comment to file
 d             Delete files from archive
 e             Extract files to current directory
 f             Freshen files in archive
 k             Lock archive
 l[t]          List archive [technical]
 m[f]          Move to archive [files only]
 p             Print file to stdout
 r             Repair archive
 rr[N]         Add data recovery record
 s[name|-]     Convert archive to or from SFX
 t             Test archive files
 u             Update files in archive
 v[t]          Verbosely list archive [technical]
 x             Extract files with full path
<Switches>
 -             Stop switches scanning
 ag[format]    Generate archive name using the current date
 ap<path>      Set path inside archive
 as            Synchronize archive contents
 av            Put authenticity verification (registered versions only)
 av-           Disable authenticity verification check
 c-            Disable comments show
 cfg-          Disable read configuration
 cl            Convert names to lower case
 cu            Convert names to upper case
 df            Delete files after archiving
 ds            Disable name sort for solid archive
 e<attr>       Set file exclude attributes
 ed            Do not add empty directories
 ep            Exclude paths from names
 ep1           Exclude base directory from names
 ep2           Expand paths to full
 f             Freshen files
 idp           Disable percentage display
 ierr          Send all messages to stderr
 ilog          Log errors to file (registered versions only)
 inul          Disable all messages
 isnd          Enable sound
 k             Lock archive
 kb            Keep broken extracted files
 m<0..5>       Set compression level (0-store...3-default...5-maximal)
 md<size>      Set dictionary size in KB (64,128,256,512,1024 or A,B,C,D,E)
 mm[f]         Multimedia compression [force]
 o+            Overwrite existing files
 o-            Do not overwrite existing files
 ol            Save symbolic links as the link instead of the file
 ow            Save or restore file owner and group
 p[password]   Set password
 p-            Do not query password
 r             Recurse subdirectories
 r0            Recurse subdirectories for wildcard names only
 rr[N]         Add data recovery record
 s[<N>,d,e]    Create solid archive
 s-            Disable solid archiving
 sfx[name]     Create SFX archive
 tk            Keep original archive time
 tl            Set archive time to latest file
 tn<time>      Add files newer than <time>
 to<time>      Add files older than <time>
 u             Update files
 v             Create volumes with size autodetection or list all volumes
 v<size>[k,b]  Create volumes with size=<size>*1000 [*1024, *1]
 vp            Pause before each volume
 w<path>       Assign work directory
 x<file>       Exclude specified file
 x@            Read file names to exclude from stdin
 x@<list>      Exclude files in specified list file
 y             Assume Yes on all queries
 z<file>       Read archive comment from file

Detail Help 

-ad     Append archive name to destination path.
This option may be useful when unpacking a group of archives.
By default RAR places files from all archives to the same
directory, but this switch creates a separate directory
for files unpacked from each archive.
Example:
rar x -ad *.rar data\
RAR will create subdirectories below 'data' for every unpacking
archive.
-ol     Save symbolic links as the link instead of the file.
        Unix version only.
-p[p]   Encrypt files with the string <p> as password while archiving.
        The password is case-sensitive. If you omit the password on the
        command line, you will be prompted with message "Enter password".
Example:
rar a -pmyhoney secret1 *.txt
add files *.txt and encrypt them with password "myhoney".
-r      Recurse subdirectories. May be used with commands:
        a, u, f, m, x, e, t, p, v, l, c, cf and s.
-s      Create solid archive. Solid is a special archive type.
Solid        An archive packed using a special compression method which
             sees all files as one continuous data stream. Particularly
             advantageous when packing a large number of small files.
Example:
create solid archive sources.rar with 512 KB dictionary,
recursing all directories, starting with the current directory.
Add only .asm files:
rar a -s -md512 sources.rar *.asm -r
-v<size>[k|b|f|m|M]
        Create volumes with size=<size>*1000 [*1024 | *1].
        By default this switch uses <size> as thousands (1000) of bytes
        (not 1024 x bytes). You may also enter the size in kilobytes
        using the symbol 'k', in bytes using the symbol 'b',
        in megabytes - 'm', in millions of bytes - 'M' or select
        one of several predefined values using the symbol 'f'
        following the numerical value. Predefined values can be
        360, 720, 1200, 1440 or 2880 and replaced with corresponding
        floppy disk size.
If the size is omitted, autodetection will be used.
If volumes are created on removable media, then after
the first volume has been created, user will be prompted
with:
Create next volume: Yes/No/All
At this moment in time, you should change the disks. Answering
'A' will cause all volumes to be created without a pause.
By default RAR volumes have names like 'volname.partNNN.rar',
where NNN is the volume number. Using -vn switch it is
possible to switch to another, extension based naming scheme,
where the first volume file in a multi-volume set has
the extension .rar, following volumes are numbered from .r00
to .r99.
-y      Assume Yes on all queries.

Damange control 

redundant recovery record 
rr[N]   Add data recovery record. Optionally, redundant information
        (recovery record) may be added to an archive.  This will cause
        a small increase of the archive size and helps to recover
        archived files in case of floppy disk failure or data losses of
        any other kind. A recovery record contains up to 524288 recovery
        sectors. The number of sectors may be specified directly in the
        'rr' command (N = 1, 2 .. 524288) or if it is not specified by
        the user it will be selected automatically according to the
        archive size: a size of the recovery information will be about
        1% of the total archive size, usually allowing the recovery of
        up to 0.6% of the total archive size of continuously damaged data.
It is also possible to specify the recovery record size in
percent to the archive size. Just append the percent character
to the command parameter. For example:
rar rr3% arcname
Note that if you run this command from .bat or .cmd file,
you need to use rr3%% instead of rr3%, because the command
processor treats the single '%' character as start of
batch file parameter. You may also use 'p' instead of '%',
so 'rr3p' will work too.
If data are damaged continuously then each rr-sector helps to
recover 512 bytes of damaged information. This value may be
lower in cases of multiple damage.
The size of the recovery record may be approximately determined
by the formula <archive size>/256 + <number of recovery
sectors>*512 bytes.
Damange recovery 
r       Repair archive. Archive repairing is performed in two stages.
        First, the damaged archive is searched for a recovery record
        (see 'rr' command). If the archive contains a recovery record
        and if the portion of the damaged data is continuous and less
        than N*512 bytes, where N is number of recovery sectors placed
        into the archive, the chance of successful archive
        reconstruction is very high. When this stage has completed,
        a new archive will be created, called fixed.arcname.rar,
        where 'arcname' is the original (damaged) archive name.
If a broken archive does not contain a recovery record or if
the archive is not completely recovered due to major damage, a
second stage is performed. During this stage only the archive
structure is reconstructed and it is impossible to recover
files which fail the CRC validation, it is still possible to
recover undamaged files which were inaccessible due to the
broken archive structure. Mostly this is useful for non-solid
archives.
When the second stage is completed, the reconstructed archive
will be saved as rebuilt.arcname.rar, where 'arcname' is
the original archive name.
RAR/DOS32 version uses _recover.rar and _reconst.rar instead
of names mentioned aboves.

Faq 

solid archive 

Q: I've heard a lot about "Solid" archives. What are they and how can I use them?

A: It has been well known, for a long time, that one method of increasing the efficiency of compression, was to copy all the files to be compressed into a single file, before compressing them. This is called creating a "Solid" file before compressing. There are programs around which indeed perform this operation and act as a pre-processor to another archiver. RAR handles this function internally and invisibly to the user, it simply "sees" all files together as a single data stream, with the end result that the final output is significantly smaller than it would otherwise be. The gain to be had from this type of archive can be significant and can be 10% - 60% of the size of the original archive.

As with any other gain, there is a price to be paid and that price should
be taken into consideration before creating a "Solid" archive.
Q: How often are you going to update or modify the archive?
A: Probably never       ..  Use a solid archive
Rarely               ..  Use a solid archive
Frequently           ..  Use a normal archive
IMPORTANT NOTE:
Beware that to extract a file from solid archive RAR scans the whole
archive from the beginning.
If you are using RAR to store archives to some unreliable storage media
(e.g. floppy disks, streamer tapes etc.) you should better use normal,
non solid mode. And you definetely should use the recovery option.
It is impossible to extract files after damaged place in the solid
archive. However in some cases special recovery information helps to
rebuild the damaged archive if it is stored to the archive (the
recovery option was on, the '-rr' switch or 'rr' command applied).
corrupted rar download 

Q: When I download a RAR archive using Netscape Navigator or Communicator, the file is corrupt, what's wrong?

A: Apache HTTP server erroneously reports the RAR archive type as text/plain and as a result, Netscape Navigator/Communicator treats the file as plain text. To prevent this happening, those webmasters, who use Apache, should create .htaccess file in each directory which has RAR archives and add the following string to it:

AddType application/x-rar-compressed rar
If .htaccess already exists, this string should be added to the
already existing file.

Rar Repair Trick 

Ever Get frustrated When Rars are missing their first part, rending them useless? Here's a little trick to salvage the remaining parts.

  1. Copy the first part of another Rar in the set to another directory—ie; Missing part 1 of Rar 3 so copy part 1 of rar 4.

  2. rename it to the missing rar—ie: x.part4.rar.01.20.BBT to x.part3.rar.01.20.BBT.

  3. using a hex editor, open the renamed rar and, right a the beginning of the file is the rar's name in 2 places. Change to new name —ie:r.04 to r.03.

  4. If the rars were numbered ie: 04/89—in the uploaded headers, you must also correct this number—ie:04/89 to 03/89.

  5. Save the file and move it to the original folder.

  6. You can now join all the parts to salvage the remaining blks.

Hpoe this helps,

Maui Guy