From owner-freebsd-questions@freebsd.org Sat Nov 30 21:08:37 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B083B1B8804 for ; Sat, 30 Nov 2019 21:08:37 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QP9w75jDz4Wh9 for ; Sat, 30 Nov 2019 21:08:36 +0000 (UTC) (envelope-from tomek@cedro.info) Received: by mail-ot1-x32f.google.com with SMTP id o9so6618803ote.2 for ; Sat, 30 Nov 2019 13:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; h=mime-version:from:date:message-id:subject:to; bh=zO4OiLmuVMRSh9C+iEct7TVX2BdFsheSJNKAseypsdU=; b=FQB8eQ7LpabMFar2G1g+xP5Bu82TKH2cN0oLzpgN8GaK5Mr415rpdsPYxLm6BA4TVZ crKQMlPxht9nY61FjfexjMlFsPfaacgzhqS+Y+y40NdL014rnKdlBQmQU7YAVTU3Grm0 YepqAkH/e296SrxJSmIb4MbWknJbF0X5A9Qmk5TSjxmbUV5NAgzHDzNHQxJA5uNcOHGq o1F9DSFIV0tTWvAop9/r4Q+Y5oNTS37MJdsJVtvtLQNGUSmtLRK3fXqIaqL/0lfHs3NV ZTcDLPd083pmP+XYqzK2Ji+o1yQrEWWj2Ai/LqV9Set33Gi6O8UW9UzElS3OiEs2DujU JIaA== 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=zO4OiLmuVMRSh9C+iEct7TVX2BdFsheSJNKAseypsdU=; b=rsbOhpcQvqwtSFpaErD1J9aIkhByewBUkfcuM6MB2TVFMwSv+reLUxDQoXSLuCdgsb XKC2s9alsDv00E1MK5EmJiZJ6Wc/rJe8T6fb5MHz5wna80CG55gb1/QMJvSzhds6rOKD k2YcFiZnQPpE3b6WUvVnUw0kbLQQ2cmp60rVFvDdOf8a+wSqBDDqW5wNv5g6lRUJwmbk EXFqwOcP/BmSqDRRnSg7NASpxho0+fs1VE+JC1ZoYvSSlr0V7ltYOmQBRXpHjeIRR2Tj ZkmXMEYyuRD+sCP9w3Aae/Me5G66L/+zMcdObNZBnSIU90Jl0prqOjJ1/wwrqNk2lNSl JYww== X-Gm-Message-State: APjAAAX6XSKr5QTgczGlp/ftcPNoLO6NcBrTuh8cnFoZkVKLzXfU4/RF uKTgPuUGhMo0LEP4c5ywM9g79iiZy4E= X-Google-Smtp-Source: APXvYqy5WePQOPHegz1V/+08QXStdCY0v7qomn+L0+MoFWCuMIMz0W8QAE2ZBP4oS9yGDbVbmf6CzA== X-Received: by 2002:a05:6830:1b6e:: with SMTP id d14mr9054632ote.120.1575148115451; Sat, 30 Nov 2019 13:08:35 -0800 (PST) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com. [209.85.210.49]) by smtp.gmail.com with ESMTPSA id m20sm8908441otr.47.2019.11.30.13.08.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Nov 2019 13:08:34 -0800 (PST) Received: by mail-ot1-f49.google.com with SMTP id i4so757845otr.3; Sat, 30 Nov 2019 13:08:34 -0800 (PST) X-Received: by 2002:a05:6830:13c8:: with SMTP id e8mr14933662otq.159.1575148114053; Sat, 30 Nov 2019 13:08:34 -0800 (PST) MIME-Version: 1.0 From: Tomasz CEDRO Date: Sat, 30 Nov 2019 22:08:21 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: pendrive clone impossible ? To: FreeBSD Questions Mailing List , "freebsd-usb@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47QP9w75jDz4Wh9 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=FQB8eQ7L; dmarc=none; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2607:f8b0:4864:20::32f) smtp.mailfrom=tomek@cedro.info X-Spamd-Result: default: False [-3.70 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[cedro.info]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[cedro.info:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[f.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.40)[ip: (-7.74), ipnet: 2607:f8b0::/32(-2.25), asn: 15169(-1.94), country: US(-0.05)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Nov 2019 21:08:37 -0000 Hello world :-) I have to clone a pendrive, the same one to another almost the same (number of sectors differs a bit). The problem is that DD does not seem to do the job. It always worked for me. Also I am not really able to clone the MBR: 1. dd if=/dev/da0 of=/dev/da1 bs=512 count=1 does not copy anything. 2. dd if=/dev/zero of=/dev/da1 bs=512 count=1 zeroes the mbr. 3. dd if=/dev/random of=/dev/da1 bs=512 count=1 randoms the mbr. 4. dd if=/dev/da0 of=da0.mbt bs=512 count1; dd if=da0.mbr bc=512 count=1 does NOT copy the mbr. 5. mdconfig -a -tvnode da0.mbr; dd if=/dev/md0 of=/dev/da1 bc=512 count=1 does put the data into mbr, but still da1 seems to have no partitions!!! In such Black Magic situations I usually put /dev/zero on a target disk, just to make sure MBR and GPT are not messed/mixed up, then re-tried and things worked. Not this time. While size of the drives differs a bit, the last partition contains FreeBSD LiveCD image and is much smaller than the partition so it can be truncated with no problem because there are zeros after. Does GEOM in any way prevents me from using disk that has corrupt MBR? Why I cannot write a MBR from a file but I can from a md0? Any hints welcome :-) Tomek # gpart backup da0 | gpart restore -F da1 gpart: size '17575936': Invalid argument ugen0.7: at usbus0 umass0 on uhub0 umass0: on usbus0 umass0: SCSI over Bulk-Only; quirks = 0x8100 umass0:2:0: Attached to scbus2 da0 at umass-sim0 bus 0 scbus2 target 0 lun 0 da0: Removable Direct Access SPC-4 SCSI device da0: Serial Number BLAHBLAH da0: 400.000MB/s transfers da0: 118368MB (242417664 512 byte sectors) da0: quirks=0x2 ugen0.8: at usbus0 umass1 on uhub0 umass1: on usbus0 umass1: SCSI over Bulk-Only; quirks = 0x8100 umass1:3:1: Attached to scbus3 da1 at umass-sim1 bus 1 scbus3 target 0 lun 0 da1: Removable Direct Access SPC-4 SCSI device da1: Serial Number BLAHBLAH da1: 400.000MB/s transfers da1: 118272MB (242221056 512 byte sectors) da1: quirks=0x2 GEOM_PART: integrity check failed (da1, MBR) FreeBSD 0xCFMX4 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 GENERIC amd64 -- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info