From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Fix the destroyed disk image partition table in a raw image file using Emacs. Date: Sun, 11 Apr 2021 21:34:36 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32910"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 11 15:35:15 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVaF8-0008Qh-Ar for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 11 Apr 2021 15:35:14 +0200 Original-Received: from localhost ([::1]:48078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVaF7-0006vh-B8 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 11 Apr 2021 09:35:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVaEn-0006vW-Na for help-gnu-emacs@gnu.org; Sun, 11 Apr 2021 09:34:53 -0400 Original-Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]:34535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVaEk-0000FS-RJ for help-gnu-emacs@gnu.org; Sun, 11 Apr 2021 09:34:53 -0400 Original-Received: by mail-lj1-x234.google.com with SMTP id l14so9128527ljb.1 for ; Sun, 11 Apr 2021 06:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=SGRFsYSbt1ZMkAONVqvGKxA1RT7QRzzyKmUWDRN1Jfg=; b=r98lRYTtXl7voUQmtAR4ImkRgRKFO+maQgdBnjZu5DfcqTPb0iwhSNyVMKHScR+n4e u3kVbVmZRbz5w3jvUm/KGy7j8YyU9/qxPOWU+oQSK8IUB3OZ0E9SMl4G1jT24TP8kETE YSGnTUWtnZWYl/2sVn6vCQT50gTrk6aVQTPWdSRvt92+aSU1yC6S58q1YuRczYIVJ0SY g2MS55jVWpXVZL9zTu2Wl62ciPTLdADydlsoA+/lioRynYLIvhsUT8/4l30vMb64wlV1 3CA8KnyJrmQVeFUOlJPNaSCPOI/KXXbFQuVxZDoX0uYebOZlcWf12w1plTG07QfJh0De QvuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=SGRFsYSbt1ZMkAONVqvGKxA1RT7QRzzyKmUWDRN1Jfg=; b=SgsbWUnq/UUPLq/nESai+w8wkqa7qPQYZWuk0K33+0NwvK6HCnNhm2FD7uk+RpvpAF gxkioDBQSDzEQ6HEgVF2jsje19Bwpi5iq39+TeVvwMeGxOVwpBsSM0Kw0BuFEXtN6NRM 8hXYjo0ljcUkUVGiUCqF33hqfJVp2OSjPNrEHbbotB8hwZaMixU02ycM3DgjJGVSlOn6 L2qHwg0tpT+CCx+4gSB314Q29Tagpoq/Aaq1Cu+UlBfkz7Ubbjzol0S0DevfSB2gapJK 9MIKlRog9PAI0eDU6gePFnHB8V+l5r0D3v0/rmqWKM2zBU+vA5xz0QIa4LCCUCvY2y2y p65A== X-Gm-Message-State: AOAM5307C6nC7fMsrEBTOEVAynLW3zN1HVF36XcftOYbMFvaAxotRP7b jrBRiRo9flqmhkV5sLZLiNS+52kdWtt1vAQQNzNSrLc+U5rNjpiQ X-Google-Smtp-Source: ABdhPJw8Q/cwRAmdovSwxfHcxgfBTAcPj66ZpC8CNx80FoaGK3zG9S6vlpeGoHeN0JNztRfvbenbAeESPbMOdjcGjd0= X-Received: by 2002:a2e:b52a:: with SMTP id z10mr14615462ljm.320.1618148088107; Sun, 11 Apr 2021 06:34:48 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=hongyi.zhao@gmail.com; helo=mail-lj1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128948 Archived-At: I've two disk image files whose partuuid info are shown as below based on the method discussed here on : $ dd if=openwrt-19.07.7-x86-64-combined-ext4.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An eb3ae1bb $ dd if=disk.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An 761b36b0 In order to change the partuuid of the 2nd disk image to the value of the 1st, I do the following operation: $ dd if=openwrt-19.07.7-x86-64-combined-ext4.img of=disk.img bs=1 count=4 skip=440 seek=440 4+0 records in 4+0 records out 4 bytes copied, 0.000195385 s, 20.5 kB/s $ dd if=disk.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An eb3ae1bb But it turns out that the disk.img will be destroyed by the above operation. So, the only usable info for now is the following data snippet extracted from the corresponding place of the original image: $ dd if=disk.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An 761b36b0 It's well known that Emacs is an 8-bit clean editor which makes it safe to edit binary files. So, I want to whether I can fix the above destroyed disk image file with Emacs for my scenario. Regards, HY -- Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Polytechnic University of Science and Technology engineering NO. 552 North Gangtie Road, Xingtai, China