Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Single disk backups no minimal installation or live CD!!!!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Feb 19, 2017 9:53 am    Post subject: Single disk backups no minimal installation or live CD!!!! Reply with quote

I am trying to backup my Gentoo system with something other than the familiar backup options to me (live CD, other bootable system like windows or minimal linux, and any other active backups while the filesystem is mounted with rw, as opposed to ro , which I understand is generally discouraged.)

Generally, I don’t like the options because of interfacing between multiple disks.

What I’d like to do is to use the disk drive in my laptop to be handling the back up as well as having it be a location for the backup files (archives) and utility that is going to be executing the job. I could probably make use of the windows installation for that which is installed alongside gentoo already on my HP laptop, but it would involve installing more than what is needed.

I figure there could be a small utility and some minor changes to partitions that could address the backup issue of needing to have reading/writing be restricted during the bare metal backup. And if so, I'd like to implement it in either an experiment with a chroot environment, or else creating a even smaller live system for just backup purposes...does anyone know if that exists for Gentoo, or some other linux and unix-friendly languages?


Code:
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk
├─sda1   8:1    0   650M  0 part
├─sda2   8:2    0   260M  0 part /boot/EFI
├─sda3   8:3    0   128M  0 part
├─sda4   8:4    0   396G  0 part /mnt/MSwindows
├─sda5   8:5    0   971M  0 part /boot
├─sda6   8:6    0  49.6G  0 part /
├─sda7   8:7    0  14.7G  0 part [SWAP]
├─sda8   8:8    0  58.6G  0 part /mnt/backups
└─sda9   8:9    0 195.3G  0 part /mnt/extra.storage
sr0     11:0    1 310.5M  0 rom 



Thnx,

J.R. /LINUX
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Sun Feb 19, 2017 12:24 pm    Post subject: Reply with quote

nm, stupid question, erase, erase. :oops:
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN


Last edited by audiodef on Tue Feb 21, 2017 2:19 am; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sun Feb 19, 2017 12:48 pm    Post subject: Reply with quote

Warning: My opinion, may be totally unrelated:


I do not recommend backup to the same drive, same model, same manufacturer drives.

My strategy, shortened.

I do create a full copy everytime from my internal laptop SSD to my external SSD. Than the external SSD is placed in my notebook, and is initalized (so it works). The internal drive is put on my shelf and is therefore my backup drive. The backup is instantly verified because the external drive is put to use, so any fails will result in a not working notebook. I use 3 drives in a cycle, so I have some older data when something goes wrong, e.g. screw up both drives. I can mostly rule out mistakes because I use lvm names instead of bad names like sdx, UUID, PUID and proper mount points.

I do have a 2nd 1TB HDD, but I consider that data as junk, or not backup worthy: e.g. distfiles, some other files which I may want to read....

Costs for Central Europe:

External USB 3.0 Case 2.5" SATA ~20 Euro
120 or 128GB SSD 2.5" SATA ~45 Euro
Sysrescue-cd ~1-2 Euro

Time: Less than a shower ~20 Min or below for 35GB to be transfered. 5 min to change drive and initialize it because of UEFI limitations. Hardware ASUS g75VW notebook.

--

I told you my way of backups. It is a full backup including everything, except junk e.g. distfiles ...

For others backups are just copy over the documents they created by hand.

Quote:
I figure there could be a small utility and some minor changes to partitions that could address the backup issue


that is endless.

rdiffbackup, rsync, dd (not recommended imho), acronis trueimange, .... check that sectino in the portage tree...
--

I do not want to screw around installing an os from scratch. Thats very time consuming. (/etc /home downloading everything again on a very slow connection, set up the desctop environment, passwords, printer, input devices, ...) My way is just 5 min and i am done with a full working environment again.

Some guys do not mind using 2-3 days (estimate) to install a new gentoo and move over the files
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Feb 19, 2017 7:38 pm    Post subject: Reply with quote

audiodef wrote:
OK, wait... please tell us that "disk drive" does not mean a floppy drive...


No, disk is internal to my HP, it's 1TB. I included the part table and that is the entire physical device i'm interested in working with. Although i don't mind removing the HD, it seems unnecessary.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Sun Feb 19, 2017 7:46 pm    Post subject: Reply with quote

Why not just backup locally and restore there? That's essentially what you are doing anyways... i guess my question could be better stated as far as cloning the disk to another physical location which is worthwhile i agree. Each of those disks (alt disk) could be accessed via network for backups so what purpose does removing the drives serve other than it could be fun and cool or to be testing it, inspecting it for other problems.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 363
Location: the Netherlands

PostPosted: Sun Feb 19, 2017 8:12 pm    Post subject: Reply with quote

Hi,

LIsLinuxIsSogood wrote:
Why not just backup locally and restore there?


I am not sure if i really understand what you want to do.

Usually, you make a backup to prevent unpredictable loss of data, for example because your disk breaks down.
That is in itself a reason *not* to do it locally.

So, if that is not the problem/not the reason for the backup, what are you actually hoping to achieve or to protect against?
But indeed, you can always locally make a second copy of all your files I guess...

Alex.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Mon Feb 20, 2017 2:56 am    Post subject: Reply with quote

Roman_Gruber wrote:

I do create a full copy everytime from my internal laptop SSD to my external SSD.


Which application and are you sure that is a bare metal backup (i.e. replica) which is what I want.

As for the situation I have in terms of my laptop, Id really prefer to utilize the single drive and just network copy all the backups as needed to my home server. I can typically run it at home right over the network and then test it out right away like was said by Roman Gruber.

Also, since I am using a tool fsarchiver, which warns against the running of a live backup but i haven't tested that yet.

I really would prefer to not use an external Hd at the time of backup, so I might just continue searching for tools that would allow for me to create some temporary recovery backup file of some sort for the primary partition on disk. Maybe if i search i will find a program that can run a good and clean live backup, and not have to be concerned with anything other than setting up a[/bug] "sync" up somehow to copy the local backup to my home server, once they are online within the same network.
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2678

PostPosted: Mon Feb 20, 2017 3:09 am    Post subject: Reply with quote

I think you are looking for rsnapshot. It basically uses rsync to make an incremental backup. It doesn't create an archive so you don't need to worry about that ball of wax. I've never had a problem with any of the backups I've made and I always run the backup as a cron job.

But in truth no backup system is going to be 100% safe on a running system, ever. It is a calculated risk. How critical is your data? How much risk are you willing to tolerate? What are you protecting against? These are all questions you should answer for yourself when designing a backup scheme.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2008

PostPosted: Mon Feb 20, 2017 9:56 am    Post subject: Reply with quote

Like others, I don't see the point of backing up to the same device, but whatever. If you disk is ext{2,3,4} formatted, I've found I can boot Gentoo in single-user mode, and run the dump command (app-arch/dump) with the disk mounted r/o if you specify "-D" to put dumpdates on the target device (or tape!) instead of in /etc
_________________
Greybeard
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Mon Feb 20, 2017 11:00 am    Post subject: Reply with quote

not sure if this is what you want, but this is what i use on one of my last ext3 systems...

weekly script, i chose sunday as its the least busy day of the week. adjust mtime on cleanup for retention policy.

Code:
#!/bin/bash

# clear old indexes
echo "Removing last weeks index files:"
find /mnt/backups/ -maxdepth 1 -name '*.index' -type f -exec rm {} \; -print

# boot
cd /
mount /dev/md0 /mnt/temp
cd /mnt/temp
echo "Backing up /boot:"
tar -zcp -g /mnt/backups/boot-$(date +%w).index -f /mnt/backups/full-boot-$(date +%Y%m%d).tar.gz .
cd /
umount /mnt/temp
echo "Done backing up /boot"

### repeat as nauseum per partition

# clear old backups
echo "Removing old backups:"
find /mnt/backups/ -maxdepth 1 -name 'full-*.tar.gz' -mtime +28 -type f -exec rm {} \; -print
find /mnt/backups/ -maxdepth 1 -name 'inc-*.tar.gz' -mtime +28 -type f -exec rm {} \; -print
echo "Done removing old backups"


daily script, can be optional with the right tweaks to the weekly script

Code:
#!/bin/bash

# boot
cd /
mount /dev/md0 /mnt/temp
cd /mnt/temp
cp /mnt/backups/boot-$(date -d yesterday +%w).index /mnt/backups/boot-$(date +%w).index
echo "Backing up /boot:"
tar -zcp -g /mnt/backups/boot-$(date +%w).index -f /mnt/backups/inc-boot-$(date +%Y%m%d).tar.gz .
cd /
umount /mnt/temp
echo "Done backing up /boot"

### repeat as nauseum per partition


this should equate to a stage4 full backup every sunday and incrementals every other day of the week. since the script is self-cleaning, you should copy files out of /mnt/backups to an alternate form of storage. to restore, you just untar like you would if you were performing a new install.

i should also note that you will occasionally see messages like "file removed/changed as we read it", these should be benign.
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Mon Feb 20, 2017 6:06 pm    Post subject: Reply with quote

This was more or less what I was trying to figure out. For those undecided about local backup, it may help to repeat back something that "bunder" mentioned, which was missing initially the use of a stage4 copy or backup that can be recovered in case of failure.

Thanks 2 all for the help

As a final note, and because I do not use a traditional boot loader such as grub or lilo, should that matter, or what else is typically included in a stage4 (is it the /boot folder either with or without the Bootloader?)
Back to top
View user's profile Send private message
LIsLinuxIsSogood
Veteran
Veteran


Joined: 13 Feb 2016
Posts: 1179

PostPosted: Mon Feb 20, 2017 11:31 pm    Post subject: Reply with quote

Since the question was previously the bottom of post, is the stage4 backup of the boot partition usually inclusive of things other than the kernel, or could that be enough in theory (to restore a functional shell etc from which the rest of the file systems and all data would be accessible from)??

Ty
Back to top
View user's profile Send private message
C5ace
Guru
Guru


Joined: 23 Dec 2013
Posts: 472
Location: Brisbane, Australia

PostPosted: Tue Feb 21, 2017 4:11 pm    Post subject: Reply with quote

LIsLinuxIsSogood wrote:
Why not just backup locally and restore there? That's essentially what you are doing anyways... i guess my question could be better stated as far as cloning the disk to another physical location which is worthwhile i agree. Each of those disks (alt disk) could be accessed via network for backups so what purpose does removing the drives serve other than it could be fun and cool or to be testing it, inspecting it for other problems.


I set up 3 years ago a laptop with an internal 500GB drive and a external 2TB USB drive. The internal drive and the first 500GB are a RAID 1 (mirrored) array and the remaining 1,5TB are for other use. When the external drive is removed, the array runs on the internal drive as degraded array. To synchronise (backup) the external dive is plugged in. The laptop can run with only the external drive. The OS used was OpenSuse. This should also work with Gentoo and 2 USB drives.

Grub legacy was used as boot loader. Grub2 did not work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum