FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-19-2009, 06:25 AM
 
Default tar on flash drive

I have a damaged system on my laptop and am trying to salvage data, then will likely install a new system (etch or lenny, was sarge). I'd like to save the home folder and a few useful files gleaned from the etc folder, keeping permissions. I'll use a live cd to do the salvage work (lenny live, knoppix, knoppix STD or slax -- I have all available) and write to a 4GB usb flash drive.

Is this the proper syntax? I believe the -c must be first and the -f last.

tar -chpvf /mnt/sda1/homebackup.tar /mnt/hda2/home

-c is create a new archive
-h is retain symlinks but not the files to which they point
-p is preserve permissions
-v is verbose
-f is indicating that the destination file name follows immediately after

Is -h the best way to handle symlinks?
Is having the destination file on a flash drive a potential problem?

On my older desktop machine running sarge drag and drop with the flash drive in K3b doesn't work well and it loaths umounting the flash drive. Sarge on the hard drive was occasionally problematic, too. Slax lists my partitions on the console as /mnt/sda1 (or /media/sda1 -- the flash drive) and /mnt/hda2 (or /media/hda2 -- it's the partition with the problem).

Your input is appreciated. Please cc me as I am not currently subcribed to the list.

-- postid


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 06:45 AM
Alex Samad
 
Default tar on flash drive

On Sun, Jan 18, 2009 at 11:25:01PM -0800, postid@BasicISP.net wrote:
> I have a damaged system on my laptop and am trying to salvage data, then will likely install a new system (etch or lenny, was sarge). I'd like to save the home folder and a few useful files gleaned from the etc folder, keeping permissions. I'll use a live cd to do the salvage work (lenny live, knoppix, knoppix STD or slax -- I have all available) and write to a 4GB usb flash drive.
>
> Is this the proper syntax? I believe the -c must be first and the -f last.
>
> tar -chpvf /mnt/sda1/homebackup.tar /mnt/hda2/home
>
> -c is create a new archive
> -h is retain symlinks but not the files to which they point
> -p is preserve permissions
> -v is verbose
> -f is indicating that the destination file name follows immediately after
>
> Is -h the best way to handle symlinks?
> Is having the destination file on a flash drive a potential problem?
>
> On my older desktop machine running sarge drag and drop with the flash drive in K3b doesn't work well and it loaths umounting the flash drive. Sarge on the hard drive was occasionally problematic, too. Slax lists my partitions on the console as /mnt/sda1 (or /media/sda1 -- the flash drive) and /mnt/hda2 (or /media/hda2 -- it's the partition with the problem).
>
> Your input is appreciated. Please cc me as I am not currently subcribed to the list.

have a look at rdiff-backup

>
> -- postid
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>

--
"And, again, I don't know where he is. I --I'll repeat what I said. I truly am not that concerned about him."

- George W. Bush
03/13/2002
Washington, DC
White House Press Conference
 
Old 01-19-2009, 10:28 AM
Ron Johnson
 
Default tar on flash drive

On 01/19/2009 01:25 AM, postid@BasicISP.net wrote:
I have a damaged system on my laptop and am trying to salvage data, then will likely install a new system (etch or lenny, was sarge). I'd like to save the home folder and a few useful files gleaned from the etc folder, keeping permissions. I'll use a live cd to do the salvage work (lenny live, knoppix, knoppix STD or slax -- I have all available) and write to a 4GB usb flash drive.


Is this the proper syntax? I believe the -c must be first and the -f last.

tar -chpvf /mnt/sda1/homebackup.tar /mnt/hda2/home


Here's what I do:
x=`date +%y%m%d.%H%M`
stime=`date +"%F %R"`
stime_sec=`date +%s`
y=`uname -n`
backup_dev=/media/backup
dest=${backup_dev}/backups/${x}
mount -v ${backup_dev}
mkdir ${dest}
tar cvpsfj ${dest}/bkup_${y}_${x}-home.tar.bz2
--recursion
--exclude=me/.mozilla/default/fq8axws8.slt/Cache
--exclude=me/.mozilla/firefox/cystlqdz.default/Cache
--exclude=me/.mozilla/iceweasel/8xw9tsaj.default/Cache
--exclude=me/.pan
--exclude=me/.pan2
--exclude=me/.googleearth/Cache
--exclude=me/.thumbnails
--exclude=me/.kde/share/apps/kmail/imap
--exclude=me/.gqview
--exclude=me/.beagle
--exclude=me/download/av
--exclude=me/download/apps_and_ISOs
--exclude=me/temp
--exclude=me/Documents
--exclude=heather/.mozilla/default/kim6buav.slt/Cache/
--exclude=heather/.evolution/mail
--exclude=heather/.evolution/cache
--exclude=heather/.sylpheed-2.0
--exclude=me/Maildir
--exclude=heather/Maildir
home/

You'll obviously have to modify it, and it may do more than you
want, but it works for me...



-c is create a new archive
-h is retain symlinks but not the files to which they point
-p is preserve permissions
-v is verbose
-f is indicating that the destination file name follows immediately after

Is -h the best way to handle symlinks?
Is having the destination file on a flash drive a potential problem?

On my older desktop machine running sarge drag and drop with the flash drive in K3b doesn't work well and it loaths umounting the flash drive. Sarge on the hard drive was occasionally problematic, too. Slax lists my partitions on the console as /mnt/sda1 (or /media/sda1 -- the flash drive) and /mnt/hda2 (or /media/hda2 -- it's the partition with the problem).


Your input is appreciated. Please cc me as I am not currently subcribed to the list.


--
Ron Johnson, Jr.
Jefferson LA USA

"I am not surprised, for we live long and are celebrated poopers."


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 11:11 AM
Paul Cartwright
 
Default tar on flash drive

On Mon January 19 2009, Ron Johnson wrote:
> ache/
> * * * * *--exclude=heather/.evolution/mail *
> * * * * *--exclude=heather/.evolution/cache *
> ********--exclude=heather/.sylpheed-2.0
> ********--exclude=me/Maildir
> ********--exclude=heather/Maildir
> * * * * *home/

does this mean you are excluding backing up email?

--
Paul Cartwright
Registered Linux user # 367800
Registered Ubuntu User #12459
 
Old 01-19-2009, 11:28 AM
Johannes Wiedersich
 
Default tar on flash drive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alex Samad wrote:
> have a look at rdiff-backup

For a one time solution, I'd prefer rsync instead of tar or
rdiff-backup. I might be biased, though, because I prefer rsync for
regular backups, too. (A small backup script creating snapshots with
rsync for me is much faster and more efficient than rdiff-backup, but
that's beyond OP's point.)

Good luck,

Johannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkl0ceIACgkQC1NzPRl9qEUpAwCfSodNsfJf7O QezFZJ2TubHEBE
XNAAn0KjLliAAHJATrpiUnQWDDmSZZwX
=H2XB
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 11:28 AM
Ron Johnson
 
Default tar on flash drive

On 01/19/2009 06:11 AM, Paul Cartwright wrote:

On Mon January 19 2009, Ron Johnson wrote:

ache/
--exclude=heather/.evolution/mail
--exclude=heather/.evolution/cache
--exclude=heather/.sylpheed-2.0
--exclude=me/Maildir
--exclude=heather/Maildir
home/


does this mean you are excluding backing up email?


In that command. The next two statements, though, are:

tar cvpsfj ${dest}/bkup_${y}_${x}-mail_ron.tar.bz2 home/me/Maildir

tar cvpsfj ${dest}/bkup_${y}_${x}-mail_heather.tar.bz2
home/heather/Maildir

I do that since my bkup_${y}_${x}-home.tar.bz2 gets quite large, and
this makes it faster if I only have to restore some email.


--
Ron Johnson, Jr.
Jefferson LA USA

"I am not surprised, for we live long and are celebrated poopers."


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 12:41 PM
Johannes Wiedersich
 
Default tar on flash drive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ron Johnson wrote:
>>
>> does this mean you are excluding backing up email?
>
> In that command. The next two statements, though, are:
>
> tar cvpsfj ${dest}/bkup_${y}_${x}-mail_ron.tar.bz2 home/me/Maildir
>
> tar cvpsfj ${dest}/bkup_${y}_${x}-mail_heather.tar.bz2
> home/heather/Maildir
>
> I do that since my bkup_${y}_${x}-home.tar.bz2 gets quite large, and
> this makes it faster if I only have to restore some email.

I use

optionen="-x --link-dest=/media/kleine500/home/sicherung/home
- --exclude=sicherung/"
quelle=/media/schnappschuss/
ziel=/media/kleine500/home/sicherung/home-$starttime
rsync $optionen -av --delete $quelle $ziel

/media/schnappschuss is my lvm snapshot created just for the purpose of
a consistent backup.

I guess that's _much_ faster than both your backup and restore. Of
course you reduce space by compression, but IMHO nowadays disk space is
cheaper than my time or my computer's time. I gain WRT time and disk
space by hard linking unchanged files. YMMV.

Johannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkl0gwEACgkQC1NzPRl9qEXEtACcDE6GRW5LJl L/yxXNLgQEriy7
z6QAn2WOihpdLrlaPzbl4BsNYl5RluSs
=rEZy
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 12:42 PM
Paul Cartwright
 
Default tar on flash drive

On Mon January 19 2009, Ron Johnson wrote:
> > does this mean you are excluding backing up email?
>
> In that command. *The next two statements, though, are:
>
> tar cvpsfj ${dest}/bkup_${y}_${x}-mail_ron.tar.bz2 home/me/Maildir
>
> tar cvpsfj ${dest}/bkup_${y}_${x}-mail_heather.tar.bz2
> * * *home/heather/Maildir
>
> I do that since my bkup_${y}_${x}-home.tar.bz2 gets quite large, and
> this makes it faster if I only have to restore some email.

so, the answer is YES, it does exclude MAIL, but you do that in another script
separately.. no problem, I just wanted to be sure what I thought you ran does
what I think it should


--
Paul Cartwright
Registered Linux user # 367800
Registered Ubuntu User #12459


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-19-2009, 03:05 PM
"Douglas A. Tutty"
 
Default tar on flash drive

On Sun, Jan 18, 2009 at 11:25:01PM -0800, postid@BasicISP.net wrote:
> I have a damaged system on my laptop and am trying to salvage data,
> then will likely install a new system (etch or lenny, was sarge). I'd
> like to save the home folder and a few useful files gleaned from the
> etc folder, keeping permissions. I'll use a live cd to do the salvage
> work (lenny live, knoppix, knoppix STD or slax -- I have all
> available) and write to a 4GB usb flash drive.
>
> Is this the proper syntax? I believe the -c must be first and the -f
> last.
>
> tar -chpvf /mnt/sda1/homebackup.tar /mnt/hda2/home
>
> -c is create a new archive -h is retain symlinks but not the files to
> which they point -p is preserve permissions -v is verbose -f is
> indicating that the destination file name follows immediately after
>
> Is -h the best way to handle symlinks? Is having the destination file
> on a flash drive a potential problem?

> Your input is appreciated. Please cc me as I am not currently
> subcribed to the list.

[done]

For what it does, yes your tar options look fine. Are you sure that you
want to lose other stuff such as /etc, your package choices, etc?

I'll attach the script I use. I alter it for each box (since each is
slightly diffferent). The script I'm attaching is what I run on the box
from which I'm sending this email (plot). It uses a list of directories
to backup and a list to exclude. I'll include those files too.

Doug.


#!/bin/bash
### special to hostname plot
# Backup to /var/local/backup/plot

# backing up directories listed in /usr/local/etc/backup/list
# and excluding those in /usr/local/etc/backup/excludelist
/bin/echo -e "System Backup"
/bin/echo -e "=============
"
/bin/echo -e "First: ensure users have saved essential stuff to ~/essential_backup,"
/bin/echo -e "either as sym-links or actual files; backup will dump links as files."
/bin/echo -e "Examples may be: exporting bookmarks list, special docs, etc."
/bin/echo -e "Backup will then save those to a separate file before"
/bin/echo -e "running the main backup program.
"
/bin/echo -e "
Backup files will be in /var/local/backup/plot/"
/bin/echo -e "and will be done in order of priority to restoring the system."
/bin/echo -e "These can then be copied to media-of-choice.a
"
/bin/echo -e "
Backup takes around 10 minutes.
"
#read -p "Press <enter> when ready to continue backup"

/bin/echo -e "
Saving grub menu.lst..."
/bin/cp -af /boot/grub/menu.lst /var/local/backup/plot
/bin/echo -e "Done.
"

/bin/echo -e "
Saving necessary /etc/files plain text..."

mkdir -m 0750 /var/local/backup/plot/etc
chown root.adm /var/local/backup/plot/etc

/bin/cp -af /etc/fstab /var/local/backup/plot/etc
/bin/cp -af /etc/modules /var/local/backup/plot/etc
/bin/cp -af /etc/hosts /var/local/backup/plot/etc
/bin/cp -af /etc/hosts.allow /var/local/backup/plot/etc
/bin/cp -af /etc/hosts.deny /var/local/backup/plot/etc
/bin/cp -af /etc/inittab /var/local/backup/plot/etc
/bin/cp -af /etc/network/interfaces /var/local/backup/plot/etc
/bin/cp -af /etc/hostname /var/local/backup/plot/etc
/bin/cp -af /etc/modutils/ /var/local/backup/plot/etc/
/bin/rm -rf /var/local/backup/plot/etc/modutils/arch
/bin/cp -af /etc/modprobe.d/ /var/local/backup/plot/etc/
/bin/cp -af /etc/resolv.conf /var/local/backup/plot/etc
/bin/cp -af /etc/ppp/ /var/local/backup/plot/etc/
/bin/cp -af /etc/chatscripts/ /var/local/backup/plot/etc/

/bin/echo -e "Done.
"

/bin/echo -e "
Saving the partition table and disk usage information..."
/sbin/fdisk -lu /dev/hda > /var/local/backup/plot/hda_partitions
/sbin/sfdisk -d /dev/hda > /var/local/backup/plot/hda_sfdisk.out
/sbin/fdisk -lu /dev/hdc > /var/local/backup/plot/hdc_partitions
/sbin/sfdisk -d /dev/hdc > /var/local/backup/plot/hdc_sfdisk.out
du -c --si --max-depth=1 /* > /var/local/backup/plot/dusummary 2>/dev/null
df --si > /var/local/backup/plot/dfsummary
/bin/echo -e "Done.
"

/bin/echo -e "
Saving package selection..."
dpkg --get-selections > /var/local/backup/plot/inst_deb.sel
aptitude search '~i!~M' > /var/local/backup/plot/apt_inst.sel
/bin/echo -e "Done.
"


/bin/echo -e "
Backing up /root/service/ to /var/local/backup/plot"
/bin/cp -af /root/service/ /var/local/backup/plot/

/bin/echo -e "
Saving etc.tgz.bak"
/bin/cp -af /var/local/backup/plot/etc.tgz /var/local/backup/plot/etc.tgz.bak
/bin/echo -e "Backing up /etc/ to /var/local/backup/plot/etc.tgz"
#/bin/tar -czf /var/local/backup/plot/etc.tgz /etc/
/bin/tar -c /etc/ | gzip --best --rsyncable > /var/local/backup/plot/etc.tgz

/bin/echo -e "Done."
/bin/echo "Removing saved etc.tgz.bak"
/bin/rm -f /var/local/backup/plot/etc.tgz.bak
/bin/echo -e "Done.
"

/bin/echo -e "
Saving es_bk.tgz.bak"
/bin/cp -af /var/local/backup/plot/es_bk.tgz /var/local/backup/plot/es_bk.tgz.bak
/bin/echo -e "Backing up /var/local/essential_backup/ >"
/bin/echo -e " /var/local/backup/plot/es_bk.tgz"

#/bin/tar -czhPf /var/local/backup/plot/es_bk.tgz /var/local/essential_backup/
/bin/tar -chP /var/local/essential_backup/ | gzip --best --rsyncable > /var/local/backup/plot/es_bk.tgz
# c=create, -h=don't dump symlinks, but files pointed to
# P=ablsolute path name so they go back exactly where they belong
/bin/echo -e "Done"
/bin/echo "Removing saved es_bk.tgz.bak"
/bin/rm -f /var/local/backup/plot/es_bk.tgz.bak
/bin/echo -e "Done.
"

#/bin/echo "Saving backup.tgz.bak"
#/bin/cp -af /var/local/backup/plot/backup.tgz /var/local/backup/plot/backup.tgz.bak
#/bin/echo -e "Backing-up complete system: > /var/local/backup/plot/backup.tgz"
#/bin/tar -czf /var/local/backup/plot/backup.tgz -T /usr/local/etc/backup/backuplist -X /usr/local/etc/backup/excludelist
#/bin/echo "Removing saved backup.tgz.bak"
#/bin/rm -f /var/local/backup/plot/backup.tgz.bak
#/bin/echo "Done."

/bin/echo -e "

Backing-up complete system: > "
/bin/echo -e " /var/local/backup/plot/backup.tgz.XX"
/bin/rm -f /var/local/backup/plot/backup.t*
#/bin/tar -cz -T /usr/local/etc/backup/backuplist -X /usr/local/etc/backup/excludelist | split -b 600m - /var/local/backup/plot/backup.tgz.
/bin/tar -c -T /usr/local/etc/backup/backuplist -X /usr/local/etc/backup/excludelist | gzip --best --rsyncable |split -b 500m - /var/local/backup/plot/backup.tgz.
/bin/echo -e "Done.
"

#/bin/echo -e "
Saving uldl.tgz.bak"
#/bin/cp -af /var/local/backup/plot/uldl.tgz /var/local/backup/plot/uldl.tgz.bak
#/bin/echo -e "Backing up /home/dtutty/uldl > /var/local/backup/plot/uldl.tgz"
#/bin/tar -czf /var/local/backup/plot/uldl.tgz /home/dtutty/uldl/
#/bin/tar -c /home/dtutty/uldl/ | gzip --best --rsyncable > /var/local/backup/plot/uldl.tgz
#/bin/echo "Removing saved uldl.tgz.bak"
#/bin/rm -f /var/local/backup/plot/uldl.tgz.bak
#/bin/echo -e "Done.
"

/bin/echo -e "
Changing oweners and permissions of /var/local/backup/plot"
/bin/chown -R root.adm /var/local/backup/plot/*
/bin/chmod -R o-rwx /var/local/backup/plot/*
/bin/chmod -R g+rw /var/local/backup/plot/*
/bin/echo -e "Done.
"

/bin/sync
/bin/echo -e "a
Backup finished.
"

/bin/echo -e "Remember to copy to appropriate media.
"

# vim: tw=0 :

/etc/
/usr/local/
/root/
/var/local/
/home/
/var/local/backup
/var/local/unbackedup
/home/dtutty/uldl
/root/uldl
/home/media
 
Old 01-19-2009, 06:39 PM
Ron Johnson
 
Default tar on flash drive

On 01/19/2009 07:42 AM, Paul Cartwright wrote:

On Mon January 19 2009, Ron Johnson wrote:

does this mean you are excluding backing up email?

In that command. The next two statements, though, are:

tar cvpsfj ${dest}/bkup_${y}_${x}-mail_ron.tar.bz2 home/me/Maildir

tar cvpsfj ${dest}/bkup_${y}_${x}-mail_heather.tar.bz2
home/heather/Maildir

I do that since my bkup_${y}_${x}-home.tar.bz2 gets quite large, and
this makes it faster if I only have to restore some email.


so, the answer is YES, it does exclude MAIL, but you do that in another script
separately..


Same script, next line.

no problem, I just wanted to be sure what I thought you ran does
what I think it should




--
Ron Johnson, Jr.
Jefferson LA USA

"I am not surprised, for we live long and are celebrated poopers."


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 08:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org