OpenWRT and Bare Metal BackUps: Difference between revisions

mNo edit summary
Line 16: Line 16:


====What to do / How to do it / Examples of...====
====What to do / How to do it / Examples of...====
Copy the MBR and "MBR Gap" (Choice of doing it in one or two steps);
Copy the MBR and "MBR Gap" (Choice of doing it in one or two steps, it's also such short process there isn't really a need to add status=progress);


* Syntax in one step;
*Syntax in one step;
** <code>dd if=/dev/sdX of=/dev/sdY bs=512 count=511</code>
**<code>dd if=/dev/sdX of=/WhatEverPath/WhatEverFileName.img bs=512 count=511</code>
* Syntax in two steps (optional);
*Syntax in two steps (optional);
** MBR: <code>dd if=/dev/sdX of=/dev/sdY bs=512 count=1</code>
**MBR: <code>dd if=/dev/sdX of=/WhatEverPath/WhatEverFileName.img bs=512 count=1</code>
** "MBR Gap": <code>dd if=/dev/sdX of=/dev/sdY bs=512 skip=1 count=511</code>
**"MBR Gap": <code>dd if=/dev/sdX of=/WhatEverPath/WhatEverFileName.img bs=512 skip=1 count=511</code>


*Working Example (in one step): <code>dd if=/dev/sdb of=/mnt/sda1/MBR_and_MBR-Gap.img conv=noerror bs=512 count=511 status=progress</code>
*Working Example (in one step): <code>dd if=/dev/sdb of=/mnt/sda1/MBR_and_MBR-Gap.img conv=noerror bs=512 count=511 status=progress</code>
Line 28: Line 28:
Copy the Boot Partition (first partition on a 'stock' / 'standard' OpenWRT x86 installation):
Copy the Boot Partition (first partition on a 'stock' / 'standard' OpenWRT x86 installation):


* Syntax: <code>dd if=/WhatEverPath/WhatEverFileName.img of=/dev/sdX skip=511 conv=noerror bs=512 status=progress</code>
*Syntax: <code>dd if=/dev/sdX of=/WhatEverPath/WhatEverFileName.img skip=511 conv=noerror bs=512 status=progress</code>


* Working Example: <code>dd if=/run/media/root/NTFS/Boot.img of=/dev/sda skip=511 conv=noerror bs=512 status=progress</code>
*Working Example: <code>dd if=/dev/sda of=/run/media/root/NTFS/Boot.img skip=511 conv=noerror bs=512 status=progress</code>


Copy the Root Partition (second partition on a 'stock' / 'standard' OpenWRT x86 installation):
Copy the Root Partition (second partition on a 'stock' / 'standard' OpenWRT x86 installation):


* Syntax: <code>dd if=/WhatEverPath/WhatEverFileName.img of=/dev/sdX skip=511 conv=noerror bs=512 status=progress</code>
*Syntax: <code>dd if=/dev/sdX of=/WhatEverPath/WhatEverFileName.img skip=511 conv=noerror bs=512 status=progress</code>


* Working Example: <code>dd if=/run/media/root/NTFS/Boot.img of=/dev/sda skip=511 conv=noerror bs=512 status=progress</code>
*Working Example: <code>dd if=/dev/sda of=/run/media/root/NTFS/Root.img skip=511 conv=noerror bs=512 status=progress</code>


==== Syntax Notes for DD ====
...and finally, issue this command, just to make sure everything is flushed from cache / memory: <code>sync</code>
 
====Syntax Notes for DD====


*if: Input File (or Device)
*if: Input File (or Device)
Line 45: Line 47:
*conv=noerror: "Don't stop, just do what I told you to do, and don't give an excuse"
*conv=noerror: "Don't stop, just do what I told you to do, and don't give an excuse"
*progress = status: Show the progress of the copy process (only for a certain version of DD and up)
*progress = status: Show the progress of the copy process (only for a certain version of DD and up)
*sync: Write all buffered blocks to disk (just to be safe)
*conv=sync: Write all buffered blocks to disk (just to be safe, but can cause 'out of space' issues with MBR and "MBR Gap")
*skip: Skips X number of sectors for the ''input ( if= )''
*seek: Skips X number of sectors for the ''output ( of= )''


====Questions About Stuff====
====Questions About Stuff====