Koozali.org: home of the SME Server

Restore from tape / Restore from USB Drive

Offline anivio

  • *
  • 18
  • +0/-0
Restore from tape / Restore from USB Drive
« on: August 17, 2010, 05:47:36 PM »
Hi!

Is it possible to restore a single file from a tape?.

If not, i would like to configure a backup with an external usb hard drive.

Is it possible to restore a single file from an external usb-drive?

Thank you.

« Last Edit: August 17, 2010, 05:50:26 PM by anivio »

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Restore from tape / Restore from USB Drive
« Reply #1 on: August 17, 2010, 06:15:42 PM »
hi

please read here

HTH

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Restore from tape / Restore from USB Drive
« Reply #2 on: August 17, 2010, 06:16:40 PM »
anivio

Quote
Is it possible to restore a single file from a tape?.

Please use the Search link at top of these forums.
You would have found this
http://forums.contribs.org/index.php/topic,45315.msg219921.html#msg219921


Quote
I would like to configure a backup with an external usb hard drive.
Is it possible to restore a single file from an external usb-drive?

Have you actually read the Manual ? Please do. Also take a look at the Server Manager Backup or Restore panel as the functionality to restore single files is included there.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline anivio

  • *
  • 18
  • +0/-0
Re: Restore from tape / Restore from USB Drive
« Reply #3 on: August 17, 2010, 07:22:53 PM »
Hi!

Thank you.

I am sorry.

I have searched the forum and the web, but have not found a solution.

It does not work. I get the following output:

Code: [Select]
[root@server01 ~]# mkdir /var/tmp/restore
[root@server01 ~]# cd /var/tmp/restore
[root@server01 restore]# mt -f /dev/nst0 rewind
[root@server01 restore]# mt -f /dev/nst0 fsf 1
[root@server01 restore]# flexbackup  -restore

flexbackup version 1.2.1 (http://flexbackup.sourceforge.net)
/etc/flexbackup.conf syntax OK

 $keyfile not found in config: default=00-index-key
 $buffer_fill_pct not found in config: default=75
 $buffer_pause_usec not found in config: default=100
|------------------------------------------------------------
| Checking 'buffer' on this machine... Ok
| Checking /bin/sh on this machine... bash1
|------------------------------------------------------------
| Logging output to "flexbackup.restore.201008172003.log"
| Reading from CURRENT TAPE POSITION
|------------------------------------------------------------
SCSI 2 tape drive:
File number=1, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x47 (TR-5).
Soft error count since last status=0
General status bits on (81010000):
 EOF ONLINE IM_REP_EN
|------------------------------------------------------------
Interactive restore for tar not implemented at /usr/bin/flexbackup line 2211.
[root@server01 restore]# ls
flexbackup.restore.201008171940.log  flexbackup.restore.201008171958.log  help
flexbackup.restore.201008171945.log  flexbackup.restore.201008172003.log
« Last Edit: August 17, 2010, 08:08:14 PM by anivio »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Restore from tape / Restore from USB Drive
« Reply #4 on: August 17, 2010, 08:41:35 PM »
Code: [Select]
Interactive restore for tar not implemented at /usr/bin/flexbackup line 2211.
AFAICT it can only restore if the dump type backup is choosen, judging from the source:
Code: [Select]
  2204      if ($cfg::type eq 'dump') {
  2205          $cmd .= "$::path{restore} -i ";
  2206          $cmd .= "$::dump_verb_flag ";
  2207          $cmd .= "$::dump_blk_flag ";
  2208          $cmd .= "-f -";
  2209
  2210      } else {
  2211          die("Interactive restore for $cfg::type not implemented");
  2212      }
Since I am not to familiar with flexbackup, but familiar with SME Server, this most likely means that the type of your backup is set to something else then dump, you can check what it is by executing this as root user:
Code: [Select]
db configuration getprop flexbackup Type
My guess is your backup is done using tar (which is the default for SME Server). I guess the man page will tell you how to extract a single file, but from a quick glance my guess it should be something like this:

1. List the contents of the tape:
Code: [Select]
flexbackup -list
2. Find the file(s) to recover and restore them:
Code: [Select]
flexbackup -extract -flist filename1 filename2
Have a look at the man pages for more information:
Code: [Select]
man flexbackup[code]
If that won't work it might be you need to restore the archive first and then use the tar command to extract the specific file.
« Last Edit: August 17, 2010, 08:43:32 PM by cactus »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline anivio

  • *
  • 18
  • +0/-0
Re: Restore from tape / Restore from USB Drive
« Reply #5 on: August 17, 2010, 10:05:08 PM »
OK. I can list all files.

Also i have tried to change the backup method to dump with the following commands:

Code: [Select]
/sbin/e-smith/config setprop flexbackup Type dump
/sbin/e-smith/expand-template /etc/flexbackup.conf

But i have changed back to tar.

Like i said above i can list files but if i try to restore all files from the list with the command

Code: [Select]
flexbackup -extract
i get the following output:

Code: [Select]
[root@server01 restore2]# cd /
[root@server01 /]# flexbackup -extract

flexbackup version 1.2.1 (http://flexbackup.sourceforge.net)
/etc/flexbackup.conf syntax OK

 $keyfile not found in config: default=00-index-key
 $buffer_fill_pct not found in config: default=75
 $buffer_pause_usec not found in config: default=100
|------------------------------------------------------------
| Checking 'buffer' on this machine... Ok
| Checking /bin/sh on this machine... bash1
|------------------------------------------------------------
| Logging output to "flexbackup.extract.201008172201.log"
| Reading from CURRENT TAPE POSITION
|------------------------------------------------------------
SCSI 2 tape drive:
File number=2, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x47 (TR-5).
Soft error count since last status=0
General status bits on (9010000):
 EOD ONLINE IM_REP_EN
|------------------------------------------------------------
| buffer -m 20m -p 75 -s 32k -t -u 100 -i "/dev/nst0" | gzip -dq | tar \
|   --extract --totals --same-permissions  --sparse  -b 64 -B --file -
|------------------------------------------------------------
buffer (reader): failed to read input: Input/output error

gzip: stdin: unexpected end of file
|------------------------------------------------------------
SCSI 2 tape drive:
File number=2, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x47 (TR-5).
Soft error count since last status=0
General status bits on (9010000):
 EOD ONLINE IM_REP_EN

I am happy to be a linux newbie.  8-)

What can i do?

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Restore from tape / Restore from USB Drive
« Reply #6 on: August 17, 2010, 10:13:01 PM »
Also i have tried to change the backup method to dump with the following commands:

Code: [Select]
/sbin/e-smith/config setprop flexbackup Type dump
/sbin/e-smith/expand-template /etc/flexbackup.conf

But i have changed back to tar.
That is the best thing to do, as backup needs to be in dump format as well to be restored from. Changing it to restore a backup made with tar will (most likely) not restore with the method to restore dumps.

Code: [Select]
|------------------------------------------------------------
| buffer -m 20m -p 75 -s 32k -t -u 100 -i "/dev/nst0" | gzip -dq | tar \
|   --extract --totals --same-permissions  --sparse  -b 64 -B --file -
|------------------------------------------------------------
buffer (reader): failed to read input: Input/output error

gzip: stdin: unexpected end of file
|------------------------------------------------------------
I am no flexbackup expert, but it seems that something is going wrong while reading back the data from the tape. Does the mentioned logfile provide additional information?
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline anivio

  • *
  • 18
  • +0/-0
Re: Restore from tape / Restore from USB Drive
« Reply #7 on: August 18, 2010, 06:29:43 PM »
It almost works now with tar mode.

One problem left: I am not able to delete the file in my user directory if i use tar mode. I have not found a way to set file permissions. If i use dump it works because i can set the file permission during restore.

My steps:

1) Rewind the tape

Code: [Select]
mt -f /dev/nst0 rewind
2) Move forward for list reading

Code: [Select]
mt -f /dev/nst0 fsf 1
3) List all files in archive

Code: [Select]
flexbackup -list
4) Steps 2 and 1 again

5) Restore single file with

Code: [Select]
flexbackup -extract -onefile <filename>
6) Rewind and eject the tape

Code: [Select]
mt -f /dev/nst0 rewoffl
« Last Edit: August 18, 2010, 08:33:37 PM by anivio »