Skip to content

Category: Backup Tapes and Disks

root sudo superuser privileges on thuban2

The only way I know how to get into thuban2 is to be on canopus or mirzam, and from there,

ssh thuban2

To do important stuff, one needs to have root (aka superuser) privileges.

I tried sudo blah blah blah with limited results.

Bruce says I need instead to do

sudo su –  (that’s a blank followed by a minus sign)

see also my entry for location of backups on canopus

where files really are on thuban2: /var/share (But not so fast for /usr/share/astro/ !)

e.g.  /var/share/data/psrdata

and /var/share/home/jweisber
(note that when I first log in to thuban2, I go to a wrong  /home jweisber  )

–joel 20220804

(But not so fast for mirzam’s /usr/share/astro/ “real” location on thuban2:

when I did a “mount” command on mirzam on 20231231, I discovered that

/usr/share/astro/ on mirzam is really on thuban2’s /var/share/astro_centos7/    !  )

–joel 20231231

tl;dr:  this stems from our upgrade from centos6 to 7. The directory still occupying thuban’s
/var/share/astro/ is a carcass from centos6 days!

To access weekly online backup on canopus last updated 2024 August

Newest update 2024 Aug to reflect that backups are have been stored on canopus: for several years:

Go to canopus:/thuban2-backups

Bruce has an automatic (cron) job do a weekly backup of thuban onto canopus.

On canopus,

df -h gives the various mount points, incl
“Filesustem” /dev/mapper/centos_canopis-thuban2–backups”\
” Mounted on”  /thuban2/backups

Navigate down to whatever file you’re looknig for, and copy over to a safe place (Careful: do not overwrite newer file of same name on thuban!)

See also post on root superuser privileges on thuban2  (although current post you are reading deals with canopus, which is where weekly backups are stored).

–joel

Howto restore files from SDLT magtape

First shutdown Algol, then turn on both tape drives, then reboot Algol. This step is necessary because SCSI devices (such as the tape drives) can only be recognized at boot time.

When restoring files/dirs, supply the ‘-P’ arg to tar.  This is a workaround that causes tar to properly restore all symlinks. Otherwise random symlinks end up as zero-length files…

Also, when restoring files, cd to /root/tapebackup/restore/ and when issuing the ‘tar’ command, omit the leading ‘/’ and wrap the filename in single quotes, so that special chars in the filepath don’t get mis-interpreted.  Here’s an example:

[root@algol restore]# mt -f /dev/nst1 rewind
[root@algol restore]# tar xvPf /dev/nst1 'data/psrdata/usr3applications/p1391/vaxplot/temps_working/P1929+10/P1929+10_TMPfxd1.inp.Z'
/home /data/psrdata /usr/share/astro /etc/secret /docs Fri Apr 13 20:00:00 CDT 2012
Reading `/home /data/psrdata /usr/share/astro /etc/secret /docs Fri Apr 13 20:00:00 CDT 2012'
data/psrdata/usr3applications/p1391/vaxplot/temps_working/P1929+10/P1929+10_TMPfxd1.inp.Z
[root@algol restore]# ls
data
root@algol restore]# mt -f /dev/nst1 eject
[root@algol restore]#

Then copy the restored file from /root/tapebackup/restore to it’s final destination.

Use algol:/root/tapebackup/backup-thuban-to-magtape.sh to create tape backups of Thuban

To create a tape backup of Thuban, insert an SDLT tape into Algol’s SDLT tape drive, ssh into Algol as root, and run /root/tapebackup/backup-thuban-to-magtape.sh.

This script writes a log file into /root/tapebackup that should be reviewed for any problems that tar might have encountered during the backup process. See the script for details.

Assuming the backup tape is written successfully (check the log file), make sure it’s actually readable by running /root/tapebackup/tar-tvf-magtape.sh. This script will prompt you for a date in ‘YYYY-MM-DD’ format (supply the date the tape was written) and will then perform a ‘tar -tvf’ on the tape, writing stdout to tar-tvf-YYYY-MM-DD.log and stderr to tar-tvf-YYYY-MM-DD.err. If the tar tvf command completes successfully, and the .err file is empty then we can have some confidence the data on the tape is readable — and we have an searchable index of the tapes contents.

For example, if you want to know what ‘.sh’ files exist in any subdirectory of /data/psrdata/usr5/1913gr/’ in any of the backup tapes, you can cd to algol:/root/tapebackup and issue the following command (note the lack of leading ‘/’, which is not present in the ‘tar -tvf’ filepaths):

grep 'data/psrdata/usr5/1913gr/' tar-tvf*.log | grep '\.sh'

…which will generate a listing like this:


tar-tvf-2010-07-01.log:-rwxrwxr-x jweisber/pulsar 3017 2010-04-06 15:08:50 data/psrdata/usr5/1913gr/tempo2010/tempoloop-gl1.sh
tar-tvf-2010-07-01.log:-rwxrwxr-x jweisber/pulsar 2801 2009-12-09 14:08:08 data/psrdata/usr5/1913gr/tempo2008/tempoloop-r-s.sh
tar-tvf-2010-07-01.log:-rwxrwx--- jweisber/pulsar 2256 2009-08-20 01:38:51 data/psrdata/usr5/1913gr/tempo2008/tempoloopfordavid.sh
tar-tvf-2010-07-01.log:-rwxrwxr-x jweisber/pulsar 3017 2010-02-16 09:33:16 data/psrdata/usr5/1913gr/tempo2008/tempoloop-gl1.sh
tar-tvf-2010-07-01.log:-rwxrwxr-x jweisber/pulsar 3017 2010-03-21 17:27:19 data/psrdata/usr5/1913gr/tempo2008/tempoloop-gl2.sh

Must supply ‘-P’ arg when extracting files from Thuban backup SDLT tape

When restoring files from a Thuban SDLT Backup tape (via Algol’s SDLT tape drive) you must specify the ‘-P’ argument’ to tar, like so:

tar -xvPf /dev/nst1 $RESTOREFILE

If '-P' is not specified, a random set of symlinks in the restored file set will end up being zero length regular files rather than symlinks.

Note that even when you supply the ‘-P’ option, the original date on the symlink is not restored, but is given the current date instead.

This bug doesn’t seem to manifest for trivially small backups, but definitely manifests in our Thuban backups.

This bug is apparently due to a race condition that occurs while tar is restoring the symlink.

See this website for a more in-depth explanation.

How to restore files from old 8mm Exabyte tapes

8mm Exabyte backup tapes written between 1994 and 2003 were created with the ufsdump command on a Solaris box. We no longer have the Solaris box, but the Exabyte tape drives are now hooked up to algol (running linux) and can be used to recover the files using restore, the linux port of ufsrestore.

Unlike ufsrestore, restore requires you to specify the blocking factor used to write the files to tape. And, since the dump scripts wrote multiple file partitions to each tape, you also need to tell restore which tape file the partition was written to on the tape. Both the blocking factor and tape file index can be determined by inspecting the the old dump logs stored on algol under /docs/thuban-docs/dumps/

Example:

Joel hands you an Exabyte tape with the label “2/9/95” on it, and asks you to recover a file from the “/usr3” partition that was written to that tape.

1. Login to algol as root

2. cd /docs/thuban-docs/dumps/1995/

3. View the dump log for that date (e.g. ./02.09.95.dmp.gz) using emacs or less (which run gunzip on the fly), and look for ‘/usr3’.

4. Determine the blocking factor used for that tape. Look for a line like: “DUMP: Writing 32 Kilobyte records“, and remember that value (’32 Kilobyte’ in this case). Note that historically the blocking factor changed over time, so always check the blocking factor used for the particular dump in question.

BLOCKING FACTOR = 32KB

UPDATE 2015-06-17: Older tapes (for which there are no dump logs) often used a blocking factor of 10KB.

UPDATE 2015-06-17: If you don’t know the block size, use the commands “mt -f /dev/st0 setblk 0; mt -f /dev/st0 setdensity 0x0” to set the drive to “variable mode”. This gives you lower performance (only 1 block is transferred for each SCSI command, plus Check Condition overhead). If you do this, don’t specify the -b <blocksize> argument when using the restore command.

5. Now determine the index of the tape file the partition you want to recover. Starting at the top of the dump log file, counting from ‘1’, count the number of “DUMP: DUMP IS DONE” lines until you get to the “DUMP: DUMP IS DONE” line for your partition.

In this dump log, partition ‘/usr3’ was written as the 16th tape file to the tape, so:

TAPE FILE INDEX = 16

6. Insert the tape in the Exabyte tape drive

7. Rewind the tape. Currently the Exabyte tape drive is /dev/st0, so issue this command:

mt -f /dev/st0 rewind

8. Tell linux what the tape density is using ‘mt‘. Linux seems to autodetect this, but just to be safe… :

mt -f /dev/st0 setdensity 0x15

If you don’t know the tape density, you can set the density to 0 instead:

mt -f /dev/st0 setdensity 0

9. Tell linux which blocksize to use with ‘mt’. In this case our BLOCKING FACTOR is 32kb, which the ‘mt’ command likes to get as an actual byte count. So we multiply 32 x 1024 to get 32768.

mt -f /dev/st0 setblk 32768

If you don’t know the blocksize, set it to 0 (and don’t specify the -b <blocksize> argument to restore:

mt -f /dev/st0 setblk 0

10. cd to the directory you want to put the recovered files in.

cd /tmp/recovery/1995-02-09

11. Call the ‘restore’ command with the following syntax:

restore -a -i -v -b <blocksize> -s <tape file index> -f /dev/st<tape drive ID>

The above arguments tell ‘restore‘ that we want to recover files in interactive mode (-i), ignore volumes (-a), and run in verbose mode (-v).

Given our BLOCKING FACTOR of 32kb and TAPE FILE INDEX of 16, we issue this command:

restore -a -i -v -b 32 -s 16 -f /dev/st0

restore‘ should now forward the tape to the 16th tape file and then enter interactive mode, which is somewhat ftp-ish.

Once in interactive mode you can use ‘cd‘ and ‘ls‘ to explore the partition. You can specify the files to extract by issuing the ‘add <fname>‘ command. When <fname> is a directory ‘add‘ recursively targets the directory and it’s contents. The ‘ls‘ command prefixes the names of files ‘add‘ed to the extraction list with an ‘*’.

For a full list of commands use the ‘help‘ command.

Once you’ve told ‘recover‘ which files to recover to your local directory with ‘add‘ commands, issue the ‘extract‘ command to initiate the recovery. This can take several minutes, up to an hour in some cases, so go do something else and come back later.

When ‘recover‘ has recovered the files it will ask you:

set owner/mode for '.'? [yn]

Answer ‘n‘.

Here’s a sample interactive recovery session. In this case we restore the directory ‘./applications/p1391/’ from the ‘/usr3’ partition saved to the ‘2/9/95’ dump tape:

[root@algol /tmp/recovery/1995-02-09]$ restore -a -i -v -b 32 -s 16 -f /dev/st0
restore > ls
.:
11.29.dmp applications/ old_lang/ spool/
aipsnewest/ lang/ software/ tmp/

restore > cd applications/
restore > ls
./applications:
book/ games/ hiabs/ psrcat/ tempo/
ftptool/ graphing/ p1391/ starlink/ timing/


restore > add p1391
restore > extract

… [WAIT UP TO AN HOUR] …

set owner/mode for '.'? [yn] n
restore > quit
[root@algol
/tmp/recovery/1995-02-09]$

Kudos to James Fuller for figuring this out.

Algol can now talk to its SDLT Tape Drive

Algol has never been able to properly communicate with the SDLT tape drive. The symptoms were that you could write/read single small file to/from the tape drive, but an attempt to write a *directory* to it drive would fail with this message in shell:

tar: /dev/st1: Cannot write: Input/output error
tar: Error is not recoverable: exiting now

…and this message in /var/log/messages:

Jan 9 15:20:08 algol kernel: st1: Error with sense data: Current st1: sense key Aborted Command
Jan 9 15:20:08 algol kernel: Additional sense: Synchronous data transfer error

The first thing that James Fuller and I did was to see if the other tape drive, a sun 8mm exabyte drive known to algol as /dev/st0, was working. It worked fine. That indicated that algol’s Adaptec 39160 scsi controller card was as least partly working.

The next thing we did was reboot algol. This wasn’t really planned as part of our attempt to get the tape drive working, but rather to test the newly installed idl7.0 license manager. But it was a good thing we did. During the boot sequence we saw a screen titled “Adaptec SCSI Select: hit Ctrl-A to enter”. Prior to this time we had no idea such a utility existed. It’s basically a BIOS for the scsi controller card.

We hit ctrl-a, entered the utility and poked around. The utility enables you to see, for each of the two “channels” A & B (ports), the devices mapped to device ID’s 0-15. On channel A, only the scsi controller itself is mapped (to device ID 7). On channel B, the exabyte tape drive was mapped to device id 0, and the Quantum SDLT was mapped to device ID 6 and the scsi controlloer to device ID 7.

Each channel screen showed a matrix of the devices and parms for each device. The first such parm was “Initiate Wide Negotiation”. This rang a bell in James’ head — he remembered reading somewhere that this parm, when turned on, could cause problems for some scsi devices. So we turned it off for device 6. Note: making this change had the side effect of changing the communications speed value from 160Mb/s to 40Mb/s.

However, when we exited the utility and allowed the reboot to complete, we could write to/read from the SDLT tape drive.

I verified that it was really working by writing /home to it, reading it back to a temporary location, and then doing a recursive diff (diff -rq /home /root/foodir/home) against the original and the copy read from the tape. There were no diffs, and /home takes up 1.5G so I feel confident that Algol can really talk to the SDLT tape drive now.

uncompress

Joel installed uncompress onto Mirzam.

He got the rpm for “ncompress” at

http://rpm.pbone.net/index.php3/stat/4/idpl/2406147/com/ncompress-4.2.4-31.i386.rpm.html