From owner-freebsd-questions@FreeBSD.ORG Sun May 3 15:16:17 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14E0CEF7 for ; Sun, 3 May 2015 15:16:17 +0000 (UTC) Received: from fly.hiwaay.net (fly.hiwaay.net [216.180.54.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1B301779 for ; Sun, 3 May 2015 15:16:16 +0000 (UTC) Received: from kabini1.local (rbn1-216-180-76-231.adsl.hiwaay.net [216.180.76.231]) (authenticated bits=0) by fly.hiwaay.net (8.13.8/8.13.8/fly) with ESMTP id t43FGE1q013790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Sun, 3 May 2015 10:16:14 -0500 Message-ID: <55463BBE.9000904@hiwaay.net> Date: Sun, 03 May 2015 10:22:29 -0453 From: "William A. Mahaffey III" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: How to restore a USB drive converted to bootable References: <5543FAA3.7050907@hiwaay.net> <20150503002420.fdcc9310.freebsd@edvax.de> <5545553F.50602@hiwaay.net> <1701096.lYLT1Yt70m@amd.asgard.uk> In-Reply-To: <1701096.lYLT1Yt70m@amd.asgard.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2015 15:16:17 -0000 On 05/03/15 05:36, Dave wrote: > On Saturday 02 May 2015 17:59:02 William A. Mahaffey III wrote: >> On 05/02/15 17:30, Polytropon wrote: >>> On Sat, 02 May 2015 17:23:13 -0453, William A. Mahaffey III wrote: >>>> On 05/02/15 16:45, Polytropon wrote: >>>>> On Sat, 02 May 2015 09:20:09 -0453, William A. Mahaffey III wrote: >>>>>> On 05/02/15 09:06, Lowell Gilbert wrote: >>>>>>> "William A. Mahaffey III" writes: >>>>>>> >>>>>>>> I am about to do some OS installs (NetBSD & OpenBSD, as it happens) on >>>>>>>> boxen under construction. I would also like to use UBCD on a flash >>>>>>>> drive to memcheck those boxen prior to installation. If I prep a USB >>>>>>>> thumb drive as either a bootable UBCD drive or an over-the-WWW >>>>>>>> installer, I wipe out the drive for its original use. Is there a way >>>>>>>> to restore the drive back to its original functionality if I wanted to >>>>>>> Is "wipe the drive and reformat" what you need to hear, or do you have >>>>>>> more requirements that you haven't made clear? >>>>>>> >>>>>> Wipe & reformat, preferably from CLI under FBSD 9.3R-p13 for >>>>>> convenience, is what I'm after. Clearly creating a bootable UBCD or >>>>>> installer will wipe out whatever was >>>>>> there before, so I just want to get back to 'virgin' USB drive. >>>>> In that case, the command >>>>> >>>>> # dd if=/dev/zero of=/dev/da0 bs=1m count=1 >>>>> >>>>> should be fine. If there is any offending GPT metadata located >>>>> at the end of the USB drive, estimate the size and also erase >>>>> the last few MBs (use skip= to do so). There is no need to >>>>> actually zero out the _whole_ drive. >>>> *Aaaaaaaaaaaaaaahhhhh*, I wasn't sure about that (zero the whole drive), >>>> thanks :-) .... >>> There are only few significant "data zones" on the USB drive. >>> The boot sector and partition table are located at the beginning, >>> and _maybe_ GPT metadata at the end. Removing both makes the >>> remaining bits and bytes practically useless (except when you >>> take it to forensics, but you don't want to recover things >>> anyway, so the result should work for you). >>> >>> However, if you want a USB drive "new" (as in "I just bought it >>> from the shop, it's fresh out of the package!"), then you have >>> to write a MSDOS (FAT) file system, install some crapware, some >>> ridiculous "drivers", and "value added" software, maybe with >>> some spying tools, malware, nagware, and non-working "encryption" >>> tools. Add several partitions and make them smaller than the >>> real size of the drive. And add a "Facebook" link. :-) >>> >>> >>> >> I was thinking of dd-ing the 1st MB or 2 off into a file, then restoring >> from that file when done, that would skip all the extra features you >> mention ;-). Would 1 or 2 MB be enough to get all of the FS info ? I >> wasn't aware you didn't have to zero everything out, that simplifies >> things a fair bit .... >> > That might be enough if you are then going to put it in a drawer, not use > it all, then restore those same few MB later. > > If you are planning on installing UBCD onto it in a some form of bootable > filesystem them I'd suggest you need to DD *at least* the size of UBCD so > you can restore any/all existing data. > You could just DD the entire pendrive and pipe it through tar/gzip if you > really want to be able to put back exactly as you found it since you don't > really know exactly where on the drive the data is. > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > I'm not sweating the data, just the functionality .... If I overwrite it w/ UBCD or something similar, I know I lose all data there, so that's no problem, I just want to (possibly) be able to revert to previous functionality .... -- William A. Mahaffey III ---------------------------------------------------------------------- "The M1 Garand is without doubt the finest implement of war ever devised by man." -- Gen. George S. Patton Jr.