Hi BitsEvening faeychild
the time is coming to backup "/"
I know for sure that typing the command into the sysrescue terminal is
going to cause fat finger and blind eye syndrome
A script is a better way to go.
So I thought I'd ask your approach.
How do you access the script.
Did you install in the sysrescue ISO?
Did you install on the "src" filesystem
Or a method I haven't thought off?
******************
************ Trial script
*********** backup only
#! /bin/bash
#
#
#
_mga_7=/dev/nvme0n1p2/
_mga_bu=/dev/nvme0n1p5/
mkdir /src
mkdir /dest
rsync -aAHSXxv /src/
/dest
## end******************************
On Wed, 13 Nov 2019 13:53:38 +1100, faeychild wrote:
******************
************ Trial script
*********** backup only
#! /bin/bash
When I do a back up, I back up the Win7 partitions (sda1, sda2 and sda3)
as separate items ...... but does the above mean that when I then back
up my MageiaLinux partitions (sda6, sda7, sda8 (/Home), etc), will I be re-backing up my Win7 directories as part of the /sda6 and /sda7 back ups??
Or can I exclude the Win7 partitions when I back up the Linux /sda6 or
/sda7 partitions, maybe by excluding the /media mount point from the
back up process??
(I hope this makes sense to you .... I'm not sure it does to me, but I tried!)
On Wed, 13 Nov 2019 13:53:38 +1100, faeychild wrote:
******************
************ Trial script
*********** backup only
#! /bin/bash
also keep you out of trouble.
So I thought I'd ask your approach.
How do you access the script.
Boot other install run level 3
login as root
bkup_mga7
or
restore_mga7
for whichever way wanting to do what to mga7
If booted runlevel 5 (gui)
click up a terminal
su - root
bkup_mga7
Did you install in the sysrescue ISO?
No. I always install on my system using Mageia iso.
Did you install on the "src" filesystem
Or a method I haven't thought off?
Starting to guess, you are asking about the script install and how to
launch it.
Placing script on a rescue cd, means you have to repeat the script install anytime you modify the script or a new release of the rescue media isinstalled.
That is way too much maintenance for me.
Having said that, method/launch depends on system setup.
I have a separate partition for my system wide stuff,
$ ls /local
bin cron icons log opt ppp tmp
config doc lock lost+found phone sounds
I'll see how far I get understanding your script
On Thu, 14 Nov 2019 00:42:46 +1100, Daniel60 wrote:
ink).
When I do a back up, I back up the Win7 partitions (sda1, sda2 and sda3)
as separate items ...... but does the above mean that when I then back
up my MageiaLinux partitions (sda6, sda7, sda8 (/Home), etc), will I be
re-backing up my Win7 directories as part of the /sda6 and /sda7 back ups??
All depends on tool/app being used and arguments given.
Or can I exclude the Win7 partitions when I back up the Linux /sda6 or
/sda7 partitions, maybe by excluding the /media mount point from the
back up process??
Heheh, yes.
(I hope this makes sense to you .... I'm not sure it does to me, but I
tried!)
Ok, in a nutshell, you can use rsync to only copy one partition at a time
and only the contents of the partition. If you were to do a "man rsync"
you might notice there are all sorts controls/options,....
How you go about doing the rsync and your requirements defines if you
want to use exclude or not.
I want the cleanest most correct backup possible. Backing up / while it
is in use, is not getting what I want.
It is dead simple to get a complete clean backup of a / partition if you
boot some other install and run the backup.
I have a rsync_b script which reads my external backup drive via the usb port. The script gets a list of partitions on the backup drive,
and rsyncs those partitions if the partition is not the current partition.
If so it skips it. I then boot some other install, run it again,
and rsync has noting new to add to previous syncs, but does update the previous partition what was skipped.
If not using media label or partition name, it becomes a maintenance
headache to have the script use device names (sda6, sda7, sda8...)
Bit Twister wrote on 14/11/2019 1:55 AM:
If not using media label or partition name, it becomes a maintenanceO.K.!! You Live ... You Learn (I think!!)
headache to have the script use device names (sda6, sda7, sda8...)
Bit Twister, if I'm reading what you typed above correctly, are you suggesting that rsync, effectively, creates one back up of the internal
Hard Drive on the external Hard Drive ... and then updates that back up
each time rsync is run??
(Is the clue in the word "rsync"?? *sync* )
I had been thinking of having multiply redundancies of my internal HD
(500GB) by, each three moths or so, maybe, creating a new, complete,
back up of my internal HD (500GB) partitions on the Ext HD (2TB).
Additional Question, if I may .... This Laptop is becoming a bit 'iffy'
being twelve years or so old. Currently to get it to boot, I have a MGA6
DVD in the drive and, when its menu comes up, I select to boot from the
HD ... and away I go. Not having completely checked out the DVD menu,
should I be able to get to the system level (Run Level Three (or
whatever)) at a suitable location to Rsync *all* partitions in one go,
or would I still have to boot into another system (MGA5 maybe) to Rsync
my main system (MGA6) to the Ext HD??
Additional Additional Question if I may ...
or tell me to bugger off if you like ;-) ..
If I Rsync my Int HD to Ext HD, including the four Linux
OS's and then I blow away, say, my MD2009.1 (sda6) from the Int HD and install MGA7 in that partition, when next I Rsync my Int HD to the Ext
HD, will it also blow away the MD2009.1 or will I just be using up some
of the otherwise unused space on the Ext HD??
On 14/11/19 1:25 am, Bit Twister wrote:
Hi Bits
An early start here to avoid interruptions.
I ran "rsync" with the usual rookie error
YOU NEED TO BE ROOT!!!!
Yep, that is why I suggested you need to have defined your requirements
like test for root user, verify not trying to backup/restore if source
or destination is mounted,...
On 18/11/19 8:30 am, Bit Twister wrote:
That is a good point.
Yep, that is why I suggested you need to have defined your requirements
like test for root user, verify not trying to backup/restore if source
or destination is mounted,...
Even though it's unlikely when running through a "junk" account, it
could happen.
I ran rsync for the second time - pre update, and it was quicker.
Script so far
*************
#!/bin/bash
#
# Check if user has root permissions
if ! [ $(id -u) = 0 ]; then
# create partition mount points
mkdir /src
mkdir /dest
# mount source and destination partitions on mount points
mount -t auto LABEL=$_src /src
mount -t auto LABEL=$_dest /dest
# run backup script
rsync --archive --acls --hard-links --sparse --xattrs
--one-file-system --verbose /src/ /dest
## end
Not at all elaborate. Bits, but it ran
---8<---8<---8<---8<---8<--cut below this line -8<---8<---8<---8<---8< #!/bin/bashtypos.
#
#
# Program to backup current installation
# Mageia_7 to a backup partition mageia_bu
set -u # Show usage of unset variables as an error to help catch
_app=${0##*/} # script name
_dev_label="" # / device label
_exe=$0 # /wherever/script_name
# Check if user has root permissionsOK! The mount instruction pulls up the data string of the partition
if [ $(id -u) -ne 0 ]; then
echo "$_exe Fatal error 1: $_app must run as Root!"
exit 1
fi
# define partitions using partition labels
_src=mageia
_dest=mageia_bu
# get /'s media label
set -- $(mount --show-labels | grep ' / ' | tr '[]' ' ')
# verify source is not mounted as /
if [ "$_dev_label" = "$_src" ] ; then
echo "$_exe Fatal error 2: $_src already mounted as /
$_app will not backup $_src when $_src mounted as /"
exit 1
fi
# create partition mount points, suppress error if already exists
mkdir --parents /src
mkdir --parents /dest
OK! The mount instruction pulls up the data string of the partition
# get /'s media label
set -- $(mount --show-labels | grep ' / ' | tr '[]' ' ')
mounted on root
The translate command removes the square brackets around the label name leaving you with "mageia" or is that $(mageia)
I don't understand the association with "set" or set itself
# verify source is not mounted as /
if [ "$_dev_label" = "$_src" ] ; then
echo "$_exe Fatal error 2: $_src already mounted as /
$_app will not backup $_src when $_src mounted as /"
exit 1
fi
Very nice. The script fails if run on the system to be backed up
You might consider going to
https://www.tldp.org/LDP/abs/html/index.html
Hit Ctrl+f and enter a space set space in the search/find box.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 26:27:19 |
Calls: | 6,646 |
Calls today: | 1 |
Files: | 12,193 |
Messages: | 5,327,944 |