Gentoo Archives: gentoo-user

From: Dirk Heinrichs <dirk.heinrichs@××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Duplicate Flash drive
Date: Sun, 13 Sep 2009 07:13:27
Message-Id: 200909130913.21591.dirk.heinrichs@online.de
In Reply to: [gentoo-user] Duplicate Flash drive by James
1 Am Sonntag 13 September 2009 04:32:43 schrieb James:
2
3 > I guess I should use 'dd' to copy the entire contents
4 > of one CF drive to another? Any example syntax with dd
5 > is welcome.
6
7 What about "man dd"?
8
9 > Should I keep a machine around to run fdisk on a new CF
10 > module, or is there a way, I can just plug the CF module
11 > into a reader/writer and burn the image onto
12 > the CF module directly, and not have to use fdisk to format
13 > first?
14
15 No, just use dd.
16
17 > What about grub and the mbr. Will dd copy over all of that information,
18 > or do I have to run grub (grub install) manually to ensure the MBR
19 > is set properly.
20
21 If you create an image of your entire device, then no. However, you will loose
22 the ability to mount and modify the image. But you could easily write a small
23 script for writing the MBR. I've never done this, but I'd bet that fdisk (or
24 one of it's many cousins) can be used in scripts to setup the partitions on
25 the fly.
26
27 So let's assume your CF card USB stick or whatever is has one partition and is
28 detected as /dev/sda.
29
30 You can then first take an image of the partition:
31
32 dd if=/dev/sda1 of=firewall.img
33
34 This image can then be mounted and modified as needed:
35
36 mkdir /mnt/firewall
37 mount -t ext2 -oloop firewall.img /mnt/firewall
38 [do modifications inside /mnt/firewall]
39 umount /mnt/firewall
40
41 then write it back to as many other CF cards you need:
42
43 dd if=firewall.img of=/dev/sdX1 (replace X as appropriate)
44
45 There should also be a possibility to copy the MBR with dd, something like
46
47 dd if=/dev/sda of=mbr.img count=512 (not sure about the count value, though).
48
49 and write it back with
50
51 dd if=mbr.img of=/dev/sda.
52
53 The only thing left is the automatic partitioning.
54
55 HTH...
56
57 Dirk

Replies

Subject Author
Re: [gentoo-user] Duplicate Flash drive Dirk Heinrichs <dirk.heinrichs@××××××.de>
Re: [gentoo-user] Duplicate Flash drive Neil Bothwick <neil@××××××××××.uk>