{"id":324,"date":"2012-05-22T16:17:48","date_gmt":"2012-05-22T10:47:48","guid":{"rendered":"http:\/\/asgaur.com\/wp\/?p=324"},"modified":"2012-05-22T16:17:48","modified_gmt":"2012-05-22T10:47:48","slug":"linux-how-to-backup-hard-disk-partition-table-mbr","status":"publish","type":"post","link":"http:\/\/www.asgaur.com\/wp\/linux-how-to-backup-hard-disk-partition-table-mbr\/","title":{"rendered":"Linux: How to backup hard disk partition table (MBR)"},"content":{"rendered":"<p><!-- Adsense block #936 not displayed since it exceed the limit of 3 --><\/p>\n<p>If you don&#8217;t want to take any chances with your data, it is recommended that you backup hard disk partition table. Last Friday I was discussing some issues with one of our customer and he pointed out me dd command.<\/p>\n<p><b>Backup MBR with dd command<\/b><\/p>\n<p>\ndd the old good command which now backup partition tables even writes CDs ;). Backing up partition is nothing but actually backing up MBR (master boot record). The command is as follows for backing up MBR stored on \/dev\/sdX or \/dev\/hdX :<\/p>\n<p><code title=\"Linux Command\">#dd if=\/dev\/sdX of=\/tmp\/sda-mbr.bin bs=512 count=1<\/code><\/p>\n<p>Replace X with actual device name such as \/dev\/sda.<\/p>\n<p>Now to <b>restore partition table<\/b> to disk, all you need to do is use dd command:<\/p>\n<p><code title=\"Linux Command\">#dd if=sda-mbr.bin of=\/dev\/sdX bs=1 count=64 <br \/>\n skip=446 seek=446<\/code><\/p>\n<p>dd command works with Solaris, HP-UX and all other UNIX like operating systems. Read man page of dd for more info.<\/p>\n<p>*************************************************<\/p>\n<p><b> man dd <\/b><\/p>\n<p>NAME<br \/>\n       dd &#8211; convert and copy a file<\/p>\n<p>SYNOPSIS<br \/>\n       dd [OPERAND]&#8230;<br \/>\n       dd OPTION<\/p>\n<p>DESCRIPTION<br \/>\n       Copy a file, converting and formatting according to the operands.<\/p>\n<p>       bs=BYTES<br \/>\n              force ibs=BYTES and obs=BYTES<\/p>\n<p>       cbs=BYTES<br \/>\n              convert BYTES bytes at a time<\/p>\n<p>       conv=CONVS<br \/>\n              convert the file as per the comma separated symbol list<\/p>\n<p>       count=BLOCKS<br \/>\n              copy only BLOCKS input blocks<\/p>\n<p>       ibs=BYTES<br \/>\n              read BYTES bytes at a time<\/p>\n<p>       if=FILE<br \/>\n              read from FILE instead of stdin<\/p>\n<p>       iflag=FLAGS<br \/>\n              read as per the comma separated symbol list<\/p>\n<p>       obs=BYTES<br \/>\n              write BYTES bytes at a time<\/p>\n<p>       of=FILE<br \/>\n              write to FILE instead of stdout<\/p>\n<p>       oflag=FLAGS<br \/>\n              write as per the comma separated symbol list<\/p>\n<p>       seek=BLOCKS<br \/>\n              skip BLOCKS obs-sized blocks at start of output<\/p>\n<p>       skip=BLOCKS<br \/>\n              skip BLOCKS ibs-sized blocks at start of input<\/p>\n<p>       status=noxfer<br \/>\n              suppress transfer statistics<\/p>\n<p>       BLOCKS  and  BYTES  may  be followed by the following multiplicative suffixes: xM M, c 1, w 2, b 512, kB 1000, K 1024, MB 1000*1000, M<br \/>\n       1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.<\/p>\n<p>       Each CONV symbol may be:<\/p>\n<p>       ascii  from EBCDIC to ASCII<\/p>\n<p>       ebcdic from ASCII to EBCDIC<\/p>\n<p>       ibm    from ASCII to alternate EBCDIC<\/p>\n<p>       block  pad newline-terminated records with spaces to cbs-size<\/p>\n<p>       unblock<br \/>\n              replace trailing spaces in cbs-size records with newline<\/p>\n<p>       lcase  change upper case to lower case<\/p>\n<p>       nocreat<br \/>\n              do not create the output file<\/p>\n<p>       excl   fail if the output file already exists<\/p>\n<p>       notrunc<br \/>\n              do not truncate the output file<\/p>\n<p>       ucase  change lower case to upper case<\/p>\n<p>       swab   swap every pair of input bytes<\/p>\n<p>       noerror<br \/>\n              continue after read errors<\/p>\n<p>       sync   pad every input block with NULs to ibs-size; when used<\/p>\n<p>              with block or unblock, pad with spaces rather than NULs<\/p>\n<p>              fdatasync physically write output file data before finishing fsync     likewise, but also write metadata<\/p>\n<p>       Each FLAG symbol may be:<\/p>\n<p>       append append mode (makes sense only for output)<\/p>\n<p>       direct use direct I\/O for data<\/p>\n<p>       dsync  use synchronized I\/O for data<\/p>\n<p>       sync   likewise, but also for metadata<\/p>\n<p>       nonblock<br \/>\n              use non-blocking I\/O<\/p>\n<p>       nofollow<br \/>\n              do not follow symlinks<\/p>\n<p>       noctty do not assign controlling terminal from file<\/p>\n<p>       Sending a USR1 signal to a running &#226;dd&#226; process makes it print I\/O statistics to standard error and then resume copying.<\/p>\n<p>              $ dd if=\/dev\/zero of=\/dev\/null&amp; pid=$!<br \/>\n              $ kill -USR1 $pid; sleep 1; kill $pid<\/p>\n<p>              18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB\/s<\/p>\n<p>       Options are:<\/p>\n<p>       &#8211;help display this help and exit<br \/>\n       &#8211;version<br \/>\n              output version information and exit<\/p>\n<p>AUTHOR<br \/>\n       Written by Paul Rubin, David MacKenzie, and Stuart Kemp.<\/p>\n<p>REPORTING BUGS<br \/>\n       Report bugs to <bug -coreutils@gnu.org>.<\/p>\n<p>COPYRIGHT<br \/>\n       Copyright &#194;&#169; 2006 Free Software Foundation, Inc.<br \/>\n       This  is  free  software.   You  may  redistribute  copies  of  it   under   the   terms   of   the   GNU   General   Public   License<br \/>\n       <http :\/\/www.gnu.org\/licenses\/gpl.html>.  There is NO WARRANTY, to the extent permitted by law.<\/p>\n<p>SEE ALSO<br \/>\n       The full documentation for dd is maintained as a Texinfo manual.  If the info and dd programs are properly installed at your site, the<br \/>\n       command<\/p>\n<p>              info dd<\/p>\n<p>       should give you access to the complete manual.<\/p>\n<p>dd (coreutils) 5.97              November 2006                           DD(1)<\/http><\/bug><\/p>\n<div class=\"item_footer\">\n<p><small><a href=\"http:\/\/asgaur.com\/asgaur.php\/2009\/06\/25\/linux-how-to-backup-hard-disk-partition\" target=\"_blank\" rel=\"noopener\">Original post<\/a> blogged on <a href=\"http:\/\/b2evolution.net\/\" target=\"_blank\" rel=\"noopener\">b2evolution<\/a>.<\/small><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you don&#8217;t want to take any chances with your data, it is recommended that you backup hard disk partition table. Last Friday I was discussing some issues with one of our customer and he pointed out me dd command. Backup MBR with dd command dd the old good command which now backup partition tables [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5],"tags":[],"class_list":["post-324","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":0,"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.asgaur.com\/wp\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}