Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping?
Date: Sun, 04 May 2008 15:25:15
Message-Id: 5bdc1c8b0805040825w2a647669x15b8762422491655@mail.gmail.com
In Reply to: Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping? by Jil Larner
1 Jil & Neil,
2 Thanks for the really great information! I'm going to give this a try today.
3
4 It strikes me that to test my backup I could create a chroot on the
5 very system I'm backing up. (Or some other system.) I follow the
6 procedure we're outlining here using the install CD and when it's done
7 I reboot the system, create a few small partitions in some extra disk
8 space, untar the files, chroot into that environment, run some
9 commands to test things, and then put the tar'ed files away for safe
10 keeping feeling pretty good that everything is where I need it should
11 the worst happen.
12
13 Again, thanks for the info. I do appreciate it.
14
15 Cheers,
16 Mark
17
18 On Sun, May 4, 2008 at 3:21 AM, Jil Larner <jil@××××.eu> wrote:
19 > Hi Mark,
20 >
21 > Mark Knecht a écrit :
22 >
23 > > [...]
24 > >
25 > > happen I have a way to restore where I am today. Since the disk usage
26 > > is currently about 4GB it seems like a great time to do it. Is this
27 > > possible? I think it's essentially what the stage 3 file is that I use
28 > > when I install, isn't it?
29 > >
30 >
31 > If you don't export stage3 and /usr/portage/ files, your backup will be
32 > lighter. The portage tree shouldn't be backed up because it shall be
33 > outdated when you'll restore, and emerge --sync will bring it back (except
34 > if you plan to restore in two weeks and have a low speed connection so you
35 > use emerge-delta-webrsync, but in that case you already know why you need to
36 > keep the tree).
37 > For stage3, you can safely discard it.
38 >
39 > Cf. exclude-dires in man tar
40 >
41 >
42 >
43 > >
44 > >
45 > > > From the running system here's what things look like right now:
46 > > >
47 > >
48 > > laptop1 ~ # df
49 > > Filesystem 1K-blocks Used Available Use% Mounted on
50 > > /dev/sda5 15820524 3641240 11375636 25% /
51 > > udev 10240 172 10068 2% /dev
52 > > /dev/sda6 1320272 189304 1063900 16% /var
53 > > /dev/sda7 10278304 312012 9444184 4% /home
54 > > shm 1003844 0 1003844 0% /dev/shm
55 > > laptop1 ~ #
56 > >
57 > >
58 >
59 > Tip: use df -h and put it as an alias (alias df='df -h' in .bashrc) ;)
60 >
61 >
62 >
63 > > My thought is to boot using the install CD, mount a USB drive at
64 > > /mnt/gentoo, then create a mount point 'backup' on the USB drive to
65 > > mount each of the 3 partitions I want to back up one at a time. ( /,
66 > > /var and /home) Then I'll mount each partition by itself and use tar
67 > > to create a single file for each partition where that file gets
68 > > written on the USB drive. When I'm done I have 3 files.
69 > >
70 >
71 > Thus, you would be able to restore only one partition if needed, and there
72 > is less chance that all your archive becomes corrupted. I would process the
73 > same way.
74 >
75 > You also ought to backup the full MBR, which is a good practice, so you can
76 > bring back your boot sector and the partition table. Backing it up if very
77 > painless, just a dd command, cf. http://gentoo-wiki.com/MBR . And it saves a
78 > *lot* of time when restoring (especially when there is @&$#! vista
79 > partitions with more sectors than there is really on the disk...)
80 >
81 >
82 >
83 > >
84 > > Restore would be to create the partitions anew, untar, install grub
85 > > from in the chroot, and reboot.
86 > >
87 >
88 > So, restore would be a dd command for the MBR, and a mkfs on your
89 > partitions, then untar your backups. So you wouldn't even need to chroot
90 >
91 >
92 >
93 >
94 > >
95 > > Is this a reasonable way to go? Is there something easier? (That seems
96 > > pretty easy to me...)
97 > >
98 >
99 > It is reasonable, for one single computer. If you've more to manage, look
100 > at dedicated software, or more complex solution as in
101 > http://gentoo-wiki.com/HOWTO_Backup
102 >
103 >
104 >
105 > >
106 > > I don't want to create images of the partitions because I might want
107 > > to put the data onto a different drive or in a different
108 > > configuration. (Like no /var or something.)
109 > >
110 >
111 > With a separate backup of the MBR, you're free to restore it or not ;) But
112 > if you want to be able to adjust your partition tables, leave free space on
113 > the drive and take a look at LVM, very powerful and easy to use by now
114 > (there's a good tutorial on howtoforge with a debian VMWare virtual machine)
115 >
116 >
117 >
118 > >
119 > > If this makes sense then what commands would I want to use to do this
120 > > correctly. Presumably it needs to tar up links, file system
121 > > permissions, and everything else. Since the Quick Install guide uses
122 > >
123 >
124 > You *must* keep permissions of your files, so if you use tar, use -p option
125 > (cf. man), as if you use cp, use -p option.
126 >
127 >
128 >
129 >
130 > > Or is there more to it?
131 > >
132 >
133 > Yep, that's it. Restore mbr, mkfs, mount, untar, sync(or umount), reboot
134 >
135 >
136 >
137 >
138 > >
139 > > I'm rambling here so I'll hope for a quick answer and then give it a try.
140 > >
141 > > Thanks in advance,
142 > > Mark
143 > >
144 > --
145 > gentoo-user@l.g.o mailing list
146 >
147 >
148 --
149 gentoo-user@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-user] tar a brand new Gentoo install to a USB drive for safe keeping? Mark Knecht <markknecht@×××××.com>