Gentoo Archives: gentoo-user

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

Replies