[SLE] ISO directory chunks--mkisofs--backup and restore
Using my SuSE 9.1 Pro CD #1 to bring up "rescue mode" in order to create an image backup of /dev/hdb2 where Linux is located I could do the following steps: # mount /dev/some_other_drive /mnt (as a place to store the ISO image) # dd if=/dev/hdb2 of =/mnt/image_dir/image_file conv=noerror,sync # mkisofs -R -l -L -A "some_label" -o /mnt/image_dir/image_file /another_drive/make_cdrom/iso_image These 3 steps will create a true image of the entire 80Gig drive when only 8Gig of space is used. But I do not have the storage capacity to duplicate an 80 Gig drive (I have Linux on just one primary partition for the entire drive) and I don't want to create a set of DVDs or CDs with nothing on them. Apparently "dd" thinks in blocks and not directories and since fragmentation might occur I cannot assume all primary directory structures below "/", such as "/lib" and "/var" are contiguous and even if there were a way of making them contiguous I don't know how to specify the number of blocks for the "dd" command (start and end points for each directory chunk). QUESTION 1: So it seems that a true image backup is not feasible in my case because of size and the large number of CDs required???? Therefore, I was thinking of doing the following instead (again using the rescue mode): 1. Using "cp" command I would copy the directory chunks /boot, /var, /etc, /dev, /lib and other directories one at a time over to a location on another drive (call it "drive" for now with the directory "store_here" holding each of the above directories chunks but only one at at time). 2. Each time for each directory chunk (example is "/var") I would do: # mkisofs -R -l -L -A "some_label" -o /drive/store_here/var /another_drive/make_cdrom/iso_image NOTE: Apparently in rescue mode there is no mkisofs command available -- only when in level 5. QUESTION 2: Anyway, I don't this this will work -- but I don't know why??? Normally (in my experience) "var" in the directory string "/drive/store_here/var" would be a file name (not a directory structure) and would be created using "dd". So instead of step 2, if I were to first create each of these directory structures into a compressed tar ball and then run mkisofs where now -- for example -- "var" is a compressed tarball of the directory "/var" I would end up with an ISO file system for each directory that I could blast onto one or a few CDs or a single DVD. I should be able to decompress and untar the tar ball from the CD ROM and put the contents anywhere I want??? But this means I do not have a true image of /dev/hdb2 or even partial images of /dev/hdb2 because I took each directory like "/lib" and "/var" and "/boot" and so on and tar balled and compressed each of them into a single file no longer considered true image pieces of /dev/hdb2. This might be okay? QUESTION 3: I think I answered my own question above. Anyway, let's say I've got these compressed tar balls blasted onto CD ROMS as ISO images. Could I use these CD ROMs as backup for the above mentioned directories on /dev/hdb2 so, for example, if part of "/var" on /dev/hdb2 was erased could I restore the damaged directory chunk using the CD ROM as described for that directory??? (I would be surprised to get NO for an answer because I think this is the standard UNIX process for back ups) QUESTION 4: Further --and this is the primary concern -- let's say the drive /dev/hdb2 goes corrupt and is no longer readable. Could I use these CD ROMs (directory chunks) to reestablish the linux system on a replacement drive and would I have to create partitions for each directory chunk? I could probably use the method in QUESTION 3. But I am wondering if there are other and better ways or maybe I've missed something very important.. Ted
The Wednesday 2005-02-02 at 11:00 -0700, Ted Hilts wrote:
Using my SuSE 9.1 Pro CD #1 to bring up "rescue mode" in order to create an image backup of /dev/hdb2 where Linux is located I could do the following steps:
# mount /dev/some_other_drive /mnt (as a place to store the ISO image) # dd if=/dev/hdb2 of =/mnt/image_dir/image_file conv=noerror,sync # mkisofs -R -l -L -A "some_label" -o /mnt/image_dir/image_file /another_drive/make_cdrom/iso_image
These 3 steps will create a true image of the entire 80Gig drive when only 8Gig of space is used.
Actually, only of the second partition.
But I do not have the storage capacity to duplicate an 80 Gig drive (I have Linux on just one primary partition for the entire drive) and I don't want to create a set of DVDs or CDs with nothing on them.
You would need to compress the image, with a pipe, to avoid creating a large temporary file.
Apparently "dd" thinks in blocks and not directories and since fragmentation might occur I cannot assume all primary directory structures below "/", such as "/lib" and "/var" are contiguous and even if there were a way of making them contiguous I don't know how to specify the number of blocks for the "dd" command (start and end points for each directory chunk).
dd copies everything as is. But there are tools out there to create directly images (partimage? mondo?). If your partition is not reiser, you even could use "dump".
Therefore, I was thinking of doing the following instead (again using the rescue mode): 1. Using "cp" command I would copy the directory chunks /boot, /var, /etc, /dev, /lib and other directories one at a time over to a location on another drive (call it "drive" for now with the directory "store_here" holding each of the above directories chunks but only one at at time).
Even better, use mkzftree.
2. Each time for each directory chunk (example is "/var") I would do: # mkisofs -R -l -L -A "some_label" -o /drive/store_here/var /another_drive/make_cdrom/iso_image
I use mc to divide the destination compressed tree in chunks that fit into a CD or DVD, and then create the appropiate iso images.
NOTE: Apparently in rescue mode there is no mkisofs command available -- only when in level 5.
QUESTION 2: Anyway, I don't this this will work -- but I don't know why???
Normally (in my experience) "var" in the directory string "/drive/store_here/var" would be a file name (not a directory structure) and would be created using "dd". So instead of step 2, if I were to first create each of these directory structures into a compressed tar ball and then run mkisofs where now -- for example -- "var" is a compressed tarball of the directory "/var" I would end up with an ISO file system for each directory that I could blast onto one or a few CDs or a single DVD. I should be able to decompress and untar the tar ball from the CD ROM and put the contents anywhere I want???
As I said, I prefer mkzftree. The result is a compressed cd/dvd that can be read directly and transparently, with the same file structure as the origianl: I can pick any single file inmediately from my backup without resort to tar/gzip tools. But, as I said, there are tools out there to generate images. Can't recomend any one personally, but they have been mentioned often in this list. -- Cheers, Carlos Robinson
participants (2)
-
Carlos E. R.
-
Ted Hilts