Find the answer to your Linux question:
Results 1 to 9 of 9
Hi, I want to be able to do some advanced backups and restores with dd tool (other products don't interest me unless I have a proof it is impossible to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    5

    dd - OS partitions backup & restore


    Hi,

    I want to be able to do some advanced backups and restores with dd tool (other products don't interest me unless I have a proof it is impossible to do it with dd). Therefore I am trying to find out if I can use dd to do 2 things :

    1) backup and restore a partition to the same location (same partition specs present in MBR). After some googling I found out this works fine, but didn't test it yet.

    For example I start a Fedora 13 Live CD and use the dd tool to backup in 2 files the 2 Windows 7 partitions: System Reserved and Windows OS partition. To test it, I will delete filesystems on the 2 partitions and then restore them with dd, and check if it's OK.

    2) backup a partition and restore it on another partition (different specs in MBR for the 2 partitions, the restore partition being at least the exact size as the backup partition), partitions being on different disks or on the same disk.

    I couldn't find in Google similar attempts, so here I am posting in this forum (to begin with).


    For point 2) I tried a test that resulted in "A disk read error occurred Press Ctrl + Alt + Del to restart". For this test, I used partitions holding Windows stuff (boot files and OS files).

    2 disks configuration (setup before test):
    - WD Caviar Blue 320GB
    ---- active NTFS primary partition : System Reserved ~120MB
    ---- NTFS primary partition : Windows OS ~20GB
    ---- NTFS primary partition : data partition ~290GB
    - Seagate Barracuda 500GB
    ---- active ext4 primary partition : grub boot partition ~1GB
    ---- LVM primary partition : Fedora 13 partition ~15GB
    ---- free space : ~100GB
    ---- ext2 primary partition : data partition ~350GB

    BIOS first boot disk is Barracuda, active partition is grub boot partition, in GRUB menu I can boot Fedora and bootstrap the Caviar MBR which starts Windows 7, System Reserved is the active partition on this disk.

    The test consists in copying the 2 Windows partitions from Caviar to Barracuda, setting BIOS to boot Barracuda first, and making the System Reserved partition that I just copied into Barracuda active. Also I used the Windows 7 install CD to fix the MBR on Barracuda to be Windows 7 compatible (bootsect /nt60 I: /mbr, I: being new System Reserved partition letter under Windows Recovery System).

    2 disks configuration (setup for test):
    - WD Caviar Blue 320GB
    ---- active NTFS primary partition : System Reserved ~120MB
    ---- NTFS primary partition : Windows OS ~20GB
    ---- NTFS primary partition : data partition ~290GB
    - Seagate Barracuda 500GB
    ---- ext4 primary partition : grub boot partition ~1GB
    ---- LVM primary partition : Fedora 13 partition ~15GB
    ---- NTFS primary partition : Windows OS ~30GB
    ---- active NTFS primary partition : System Reserved ~200MB
    ---- free space : ~450GB

    When booting I get the "A disk read error occurred Press Ctrl + Alt + Del to restart". The Ctrl + Alt + Del combo doesn't work and I have to press the power button to shut down the PC.

    Does anyone have an idea why do I have this error ?

    NB: the 2 Windows partitions I copied from Caviar to Barracuda seem to work since I could list the files in both from Fedora 13 Live and could create 2 files to identify the new partitions in the Windows Recovery System.

    Another question related to this test is : Does the NTFS filesystem make use of absolute disk sector references which could explain the error message ? Does such a filesystem exist ? According to this document www . win . tue . nl/~aeb/linux/vfs/trail-3.html the block / sector conversion seems to be done at a level lower than the filesystem type dependent code in the Linux kernel, also hard coded sector references in filesystems don't make sense. What about Windows kernel ?

    Thanks
    Last edited by d3nn16; 12-23-2010 at 07:47 PM.

  2. #2
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    On your Seagate Barracuda 500GB there are 2 active partitions, that is not permitted with MS MBR boot code , but not sure of what error would be shown.

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    5
    Actually it is a copy paste error (now it's corrected). I redid the test and I checked of which partition is active with cfdisk and there is only one partition active (the new System Reserved partition is the active one during the boot while doing the test).

  4. #4
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    "A disk read error occurred Press Ctrl + Alt + Del to restart"
    My first thinking that error is comeing from the bios but it could be from Win 7. If you can not tell, install grub to MBR. If you still get error then it is from the bios, if not its from Win 7.

    Just what is the 'System Reserved partition' ?

    Does the NTFS filesystem make use of absolute disk sector references which could explain the error message ?
    Do not have Win 7 but XP does use the absolute sector # to determine just what partition to boot along with hdd ID code in the MBR, it is stored in registry hklm/???/mounted devices. Normaly XP will over come problem if there is only one XP readable partition, but there in no error message , just will not boot.

    Grub does use absolute sector #'s for finding the next stage. That does include both grub legacy and grub 2.

    Would like to see output from 'fdisk -l' , to help determine that there is not a problem with the partition information.

    What complete 'dd' command did you use ?

    Might read Unix dd command and image creation

  5. #5
    Just Joined!
    Join Date
    Dec 2010
    Posts
    5
    My first thinking that error is comeing from the bios but it could be from Win 7. If you can not tell, install grub to MBR. If you still get error then it is from the bios, if not its from Win 7.
    I backed up MBRs from both disks, plus the MBR that the "bootsect /nt60 H: /mbr" command writes. After the test I write back with Fedora 13 Live CD the GRUB MBR I backed up. And I also set back the GRUB partition to active (otherwise it doesn't boot).
    When the boot process starts I see output from various BIOSes (graphic card, motherboard, SATA PCI card), if I have a CD in the CD driver I see the prompt to press a key and if I press no key I get the error message "a disk read error ..."

    Just what is the 'System Reserved partition' ?
    When you install Windows 7 it creates 2 partitions. What I call 'System Reserved partition' (that's the name displayed in Windows disk management if I remember well) is the partition that holds the Windows 7 Boot Manager. The second partition is the one where Windows is installed (the WINDOWS folder).

    What complete 'dd' command did you use ?
    dd if=/dev/sda2 of=/dev/sdb4 (Windows OS moved)
    dd if=/dev/sda1 of=/dev/sdb3 (System Reserved partition moved)

    Would like to see output from 'fdisk -l' , to help determine that there is not a problem with the partition information.
    [root@localhost ~]# fdisk -l

    Disk /dev/sda: 320.1 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xcf67d961

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13 102400 7 HPFS/NTFS
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 13 2593 20724736 7 HPFS/NTFS
    /dev/sda3 2594 38913 291740400 7 HPFS/NTFS

    Disk /dev/sdb: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xbaf86491

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 128 1024000 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sdb2 128 2678 20480000 8e Linux LVM
    /dev/sdb3 6325 6349 192780 7 HPFS/NTFS
    /dev/sdb4 2678 6325 29294527+ 7 HPFS/NTFS

    Partition table entries are not in disk order

    Disk /dev/sdc: 32.3 GB, 32296140800 bytes
    255 heads, 63 sectors/track, 3926 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x2cd2a435

    Device Boot Start End Blocks Id System
    /dev/sdc1 1 3927 31536128 7 HPFS/NTFS

    Disk /dev/dm-0: 15.7 GB, 15728640000 bytes
    255 heads, 63 sectors/track, 1912 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/dm-0 doesn't contain a valid partition table

    Disk /dev/dm-1: 5238 MB, 5238685696 bytes
    255 heads, 63 sectors/track, 636 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/dm-1 doesn't contain a valid partition table

  6. #6
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    After the test I write back with Fedora 13 Live CD the GRUB MBR I backed up. And I also set back the GRUB partition to active (otherwise it doesn't boot).
    You are saying it does boot, so the error is from Win 7 and not the bios.
    If GRUB is installed in the MBR, it would not matter where the active flag is. That indicates GRUB is installed on your linux boot partition with the MBR boot code being MS's or a generic.

    You can download/run 'boot info script' and it will tell you just what boot code is where. Boot Info Script | Download Boot Info Script software for free at SourceForge.net

    I do not know the Win 7 how-to but might need to 'repair boot loader'.

    The new NTFS partitions are bigger ' as listed in the MBR' but the VBR 'Volume boot record' will have the old partition size, that could cause a problem with Win7. How NTFS Works: Local File Systems

    The 'dd' command you are using is not the best if you read link in proi post.

    Have never use 'dd' to make a copy of partition nor use Win7, so can only assume posible problem.

  7. #7
    Just Joined!
    Join Date
    Dec 2010
    Posts
    5
    You can download
    /run 'boot info script' and it will tell you just what boot code is where. Boot Info Script | Download Boot Info Script software for free at SourceForge.net
    I never thought there would be so many variants of MBR codes out there to require such a long script to test them. I took a look at the first pages of the script but doesn't talk much to me. So I prefer posting a hex dump of my MBR (I feel a bit uncomfortable running scripts from the Internet) :

    Code:
    [root@localhost ~]# dd if=/dev/sdb count=1 | hexdump -C
    1+0 records in
    1+0 records out
    512 bytes (512 B) copied, 6.057e-05 s, 8.5 MB/s
    00000000  eb 48 90 d0 bc 00 7c 8e  c0 8e d8 be 00 7c bf 00  |.H....|......|..|
    00000010  06 b9 00 02 fc f3 a4 50  68 1c 06 cb fb b9 04 00  |.......Ph.......|
    00000020  bd be 07 80 7e 00 00 7c  0b 0f 85 0e 01 83 c5 10  |....~..|........|
    00000030  e2 f1 cd 18 88 56 00 55  c6 46 11 05 c6 46 03 02  |.....V.U.F...F..|
    00000040  80 00 00 80 0f 87 04 00  00 08 fa 90 90 f6 c2 80  |................|
    00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
    00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 f6 c2 80  |. ..@|<.t...R...|
    00000070  74 54 b4 41 bb aa 55 cd  13 5a 52 72 49 81 fb 55  |tT.A..U..ZRrI..U|
    00000080  aa 75 43 a0 41 7c 84 c0  75 05 83 e1 01 74 37 66  |.uC.A|..u....t7f|
    00000090  8b 4c 10 be 05 7c c6 44  ff 01 66 8b 1e 44 7c c7  |.L...|.D..f..D|.|
    000000a0  04 10 00 c7 44 02 01 00  66 89 5c 08 c7 44 06 00  |....D...f.\..D..|
    000000b0  70 66 31 c0 89 44 04 66  89 44 0c b4 42 cd 13 72  |pf1..D.f.D..B..r|
    000000c0  05 bb 00 70 eb 7d b4 08  cd 13 73 0a f6 c2 80 0f  |...p.}....s.....|
    000000d0  84 f0 00 e9 8d 00 be 05  7c c6 44 ff 00 66 31 c0  |........|.D..f1.|
    000000e0  88 f0 40 66 89 44 04 31  d2 88 ca c1 e2 02 88 e8  |..@f.D.1........|
    000000f0  88 f4 40 89 44 08 31 c0  88 d0 c0 e8 02 66 89 04  |..@.D.1......f..|
    00000100  66 a1 44 7c 66 31 d2 66  f7 34 88 54 0a 66 31 d2  |f.D|f1.f.4.T.f1.|
    00000110  66 f7 74 04 88 54 0b 89  44 0c 3b 44 08 7d 3c 8a  |f.t..T..D.;D.}<.|
    00000120  54 0d c0 e2 06 8a 4c 0a  fe c1 08 d1 8a 6c 0c 5a  |T.....L......l.Z|
    00000130  8a 74 0b bb 00 70 8e c3  31 db b8 01 02 cd 13 72  |.t...p..1......r|
    00000140  2a 8c c3 8e 06 48 7c 60  1e b9 00 01 8e db 31 f6  |*....H|`......1.|
    00000150  31 ff fc f3 a5 1f 61 ff  26 42 7c be 7f 7d e8 40  |1.....a.&B|..}.@|
    00000160  00 eb 0e be 84 7d e8 38  00 eb 06 be 8e 7d e8 30  |.....}.8.....}.0|
    00000170  00 be 93 7d e8 2a 00 eb  fe 47 52 55 42 20 00 47  |...}.*...GRUB .G|
    00000180  65 6f 6d 00 48 61 72 64  20 44 69 73 6b 00 52 65  |eom.Hard Disk.Re|
    00000190  61 64 00 20 45 72 72 6f  72 00 bb 01 00 b4 0e cd  |ad. Error.......|
    000001a0  10 ac 3c 00 75 f4 c3 00  00 00 00 00 00 00 00 00  |..<.u...........|
    000001b0  00 00 00 00 00 00 00 00  91 64 f8 ba 00 00 80 01  |.........d......|
    000001c0  01 00 83 7b 3b 7f 3f 00  00 00 00 40 1f 00 00 7b  |...{;.?....@...{|
    000001d0  3c 7f 8e fe ff ff 3f 40  1f 00 00 00 71 02 00 fe  |<.....?@....q...|
    000001e0  ff ff 07 fe ff ff be 3f  0e 06 18 e2 05 00 00 fe  |.......?........|
    000001f0  ff ff 07 fe ff ff 3f 40  90 02 7f ff 7d 03 55 aa  |......?@....}.U.|
    00000200

    Code:
    I do not know the Win 7 how-to but might need to 'repair boot loader'.
    I thought of this myself. But when I boot into Windows Recovery CD, the only systems it discovers is the one from the Caviar disk (and not the one I just copied to Barracuda disk). Or were you thinking at another boot load repair method ?


    The new NTFS partitions are bigger ' as listed in the MBR' but the VBR 'Volume boot record' will have the old partition size, that could cause a problem with Win7. How NTFS Works: Local File Systems
    I will do another test with partitions of identical sizes. I used cfdisk until now and I could only enter sizes in MB.


    The 'dd' command you are using is not the best if you read link in proi post.
    I partially read the article about dd (Unix dd command and image creation), which is quite long, but I couldn't find why the dd command isn't the best given what I am trying to use it for in this context. I saw some alternatives for copying corrupted disks and other but it's not the case here.

    One interesting part of that article was a link to a page describing how to copy NTFS between 2 disks (the author describes how to set sector level identical partitions with fdisk).


    Have never use 'dd' to make a copy of partition nor use Win7, so can only assume posible problem.
    I suppose you are more familiar with ext / LVM type of file systems. Then can you tell me if it is possible to boot my Linux partitions (GRUB partition and LVM partition) after copying them to another disk ? or copying them to other partitions on the same disk ? I suppose this cannot be done if these file systems contain some kind of absolute references to disk sectors in a hardcoded manner.

  8. #8
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    Have never have and will not use LVM, can not use my old dos tools to do a thing with them. The only absolute sector reference is with GRUB, so if the grub files are moved one would have to reinstall grub.

    If one changes the partition #'s for linux then /ect/fstab would need to be changed before it will boot, just how it works with LVM partitions , I do not know.

    the only systems it discovers is the one from the Caviar disk (and not the one I just copied to Barracuda disk).
    That does not sound good to me, that might point to a file system error and 'check disk' might be needed.

    What I say below will be for XP but might be same problem with 7.

    000001b0 00 00 00 00 00 00 00 00 91 64 f8 ba 00 00 80 01
    The 4 bytes in red are the hdd ID # for MS.

    000001e0 ff ff 07 fe ff ff be 3f 0e 06 18 e2 05 00

    in blue is the partition type, '07' is NTFS
    in green is the start sector # for the partition.

    The hdd ID # and start sector # is stored in the registry {HKLM/System/MountedDevices} to tell XP where to find the OS files. The cloned XP will have the registry telling it to read the original hdd and not the clone.
    With XP when both the original and clone are in the system ,when booting to the clone it will cross boot into both the original and clone after a long boot delay. If only the clone is in system, XP will correct itself. With '7' it might just give the error you are receiving.

    Hope some one else will join in that has more knowledge with Win 7. 'hint to some one'

  9. #9
    Just Joined!
    Join Date
    Dec 2010
    Posts
    5
    I quit trying to test booting Windows 7 after copying its partitions to another disk. For now I will only do backups to restore them on same disks.

    So I tried dd_rhelp to backup each partition but for the 20GB partition I get this kind of error :
    ...
    * errs: 1
    ...
    ... success
    ...
    * errs: 2
    ...
    ... success
    ...
    * errs: 3
    ...
    ... success
    ...
    * errs: 4
    ...
    ... success
    ...
    dd_rescue: (fatal): maxerr reached!

    I didn't save the exact error messages. I was running dd_rhelp after booting into Fedora install CD to backup partitions to files.

    Finallty I used dd if/... of=/... conv=noerror,sync and the partition image was 20GB instead of 14GB as dd_rhelp creates.

    Now I'll try check the filesystems on the partition images I obtained with dd.


    Is there a way to make dd_rhelp not stop at this kind of error ? I know dd_rhelp uses dd_rescue and dd_rescue has the -e option that sets a max error threshold or disables any threshold (with value 0). I would like to have dd_rhelp check for a number of times I specify somewhere and then if this threshold of max block read errors is reached replace the block with zeros in output file. For now it just stops at the error mentioned above.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •