From owner-freebsd-fs Sun Feb 16 2:37: 4 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16AAE37B401 for ; Sun, 16 Feb 2003 02:37:03 -0800 (PST) Received: from ra.dweebsoft.com (ra.dweebsoft.com [209.237.40.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86B5A43F93 for ; Sun, 16 Feb 2003 02:37:02 -0800 (PST) (envelope-from daxbert_news@dweebsoft.com) Received: from daxhome (anubis.dweebsoft.com [64.81.58.36]) by ra.dweebsoft.com (8.12.6/8.12.6) with SMTP id h1GAb2bN058355 for ; Sun, 16 Feb 2003 02:37:02 -0800 (PST) (envelope-from daxbert_news@dweebsoft.com) Message-ID: <016b01c2d5a7$5753ce40$8a01a8c0@dweebsoft.com> From: "Daxbert" To: Subject: ntfs and rw in -CURRENT Date: Sun, 16 Feb 2003 02:37:01 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4920.2300 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4920.2300 Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Should I be able to simply create a file (ie touch foo) on an NTFS volume that's mounted rw? I'm following -CURRENT... did I miss something from the man page? I thought that at least minimal write support was available? The mkdir foo returning that . doesn't exist seems unusual. # su - # mkdir -p /mnt/w2k_d # chown root:wheel /mnt/w2k_d # chmod 777 /mnt/w2k_d # mount -t ntfs -o rw /dev/ad0s5 /mnt/w2k_d # cd /mnt/w2k_d # mount | grep w2k /dev/ad0s5 on /mnt/w2k_d (ntfs, local) # df -k w2k_d Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s5 69754198 47186058 22568140 68% /mnt/w2k_d # touch foo (a file which doesn't exist) touch: foo: No such file or directory # touch ra (a file which does exist) touch: ra: Operation not supported # mkdir foo mkdir: .: No such file or directory Any ideas or suggestions on how to proceed? --daxbert To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Mon Feb 17 10:29:16 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9E8337B401 for ; Mon, 17 Feb 2003 10:29:14 -0800 (PST) Received: from mail-out1.apple.com (mail-out1.apple.com [17.254.0.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51C2D43F3F for ; Mon, 17 Feb 2003 10:29:14 -0800 (PST) (envelope-from mday@apple.com) Received: from mailgate2.apple.com (A17-129-100-225.apple.com [17.129.100.225]) by mail-out1.apple.com (8.12.3/8.12.3) with ESMTP id h1HITEg7019319 for ; Mon, 17 Feb 2003 10:29:14 -0800 (PST) Received: from scv3.apple.com (scv3.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.2.1) with ESMTP id ; Mon, 17 Feb 2003 10:29:13 -0800 Received: from apple.com (daylight.apple.com [17.202.44.244]) by scv3.apple.com (8.11.3/8.11.3) with ESMTP id h1HIT9f09291; Mon, 17 Feb 2003 10:29:09 -0800 (PST) Date: Mon, 17 Feb 2003 10:27:20 -0800 Subject: Re: ntfs and rw in -CURRENT Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: freebsd-fs@FreeBSD.ORG To: Daxbert From: Mark Day In-Reply-To: <016b01c2d5a7$5753ce40$8a01a8c0@dweebsoft.com> Message-Id: <73572669-42A5-11D7-B8F4-00039354009A@apple.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.551) Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Sunday, February 16, 2003, at 02:37 AM, Daxbert wrote: > Should I be able to simply create a > file (ie touch foo) on an NTFS volume > that's mounted rw? No, you can't. > I'm following -CURRENT... did I miss > something from the man page? > I thought that at least minimal > write support was available? You just need a stricter definition of "minimal." :-) That minimal write support only allows you to overwrite bytes that already exist in a non-compressed file. That means no growing or shrinking of files. You can't create, delete, move, rename files or directories. You can't change metadata. -Mark To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Tue Feb 18 19:24:55 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51CC337B401 for ; Tue, 18 Feb 2003 19:24:54 -0800 (PST) Received: from cs.rpi.edu (mumble.cs.rpi.edu [128.213.8.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B5E043F3F for ; Tue, 18 Feb 2003 19:24:53 -0800 (PST) (envelope-from guptar@cs.rpi.edu) Received: from antares.cs.rpi.edu (antares.cs.rpi.edu [128.213.12.33]) by cs.rpi.edu (8.9.3/8.9.3) with ESMTP id WAA28203; Tue, 18 Feb 2003 22:24:30 -0500 (EST) Received: from localhost (guptar@localhost) by antares.cs.rpi.edu (8.11.6+Sun/8.9.3) with ESMTP id h1J3OUx19570; Tue, 18 Feb 2003 22:24:30 -0500 (EST) X-Authentication-Warning: antares.cs.rpi.edu: guptar owned process doing -bs Date: Tue, 18 Feb 2003 22:24:30 -0500 (EST) From: Rashim Gupta To: Cc: Rashim Gupta , "David E. Cross" , Subject: Re: Why is there no JFS? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Well, to answer your question, we (at the Computer Science Department at RPI) are working on logging the meta-data for the UFS File system. We have already (almost) finished with the logging part of the meta-data into a file and are currently working on getting the File system back up using the log file that we have generated. Rashim -----Original Message----- From: "Daxbert" To: "Bill Moran" , "Heinrich Rebehn" Date: Wed, 12 Feb 2003 13:16:14 -0800 Subject: Why is there no JFS? The inspiration for this email was from a thread in -questions: "Re: fsck takes very long after crash/reset" Is anybody currently working on or does there exist a JFS for FreeBSD? I've read in the archives, the discussion about not really needing JFS because of the benefits of softupdates. As well as some talk about BSD / GPL license issues. Is there not a JFS for FreeBSD becuase, Softupdates do the job just fine and nobody has the time or interest to work on this? I'm not running FreeBSD 5.x. So I'm not able to take advantage of the background fsck. Can anybody comment on their success w/ the background fsck? If a JFS were to be ported and/or developed for FreeBSD what should it be based on? XFS, JFS, ReiserFS??? Who would be considered the "maintainer" for this type of work? --daxbert To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Wed Feb 19 13:20:32 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC34537B401; Wed, 19 Feb 2003 13:20:24 -0800 (PST) Received: from smtp.inode.at (goliath.inode.at [195.58.161.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3203A43F93; Wed, 19 Feb 2003 13:20:23 -0800 (PST) (envelope-from mranner@inode.at) Received: from line101.adsl-dynamic.inode.at ([213.229.7.101]) by smtp.inode.at with esmtp (Exim 3.34 #1) id 18lbdc-0004H2-00; Wed, 19 Feb 2003 22:20:20 +0100 From: Michael Ranner To: freebsd-fs@freebsd.org Subject: scan_ffs for UFS2 Date: Wed, 19 Feb 2003 22:20:12 +0100 User-Agent: KMail/1.5 Cc: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_MU/U+5seNB+VrtY" Message-Id: <200302192220.12731.mranner@inode.at> Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --Boundary-00=_MU/U+5seNB+VrtY Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello! I am trying to learn scan_ffs (original from OpenBSD, ported to FreeBSD by Robert Watson) about UFS2 on 5-CURRENT, but it will not find the Superblock and I dont understand exactly both for loops, especially that 512 byte increment. Scan_ffs is a system tool from OpenBSD to recover erased disklabels from your hard drive. Thanks for your input. -- /\/\ichael Ranner mranner@jawa.at - mranner@bitonline.cc - webmaster@mariazell.at ---------------------------------------------------------------------- JAWA Management Software GmbH - http://www.jawa.at/ Liebenauer Hauptstrasse 2oo - A-8041 Graz Tel +43 316 403274 21 - Fax +43 316 403274 10 ---------------------------------------------------------------------- Mariazell Online - http://www.mariazell.at/ ---------------------------------------------------------------------- -----BEGIN GEEK CODE BLOCK----- GIT/CS/AT dx(-) s+:(++:) a- C++ UBLVS++++$ P++>+++$ L-(+)$ E--- W+++$ N+(++) o-- K- w--()$ O-(--) M@ V-(--) PS+>++ PE(-) Y+ PGP(-) t+ 5+ X+++(++++) R* tv++ b+(++) DI++ D-(--) G- e h--(*) r++ y? ------END GEEK CODE BLOCK------ --Boundary-00=_MU/U+5seNB+VrtY Content-Type: text/x-csrc; charset="us-ascii"; name="scan_ffs.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="scan_ffs.c" /* $OpenBSD: scan_ffs.c,v 1.8 2002/07/03 22:32:33 deraadt Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Tobias Weingartner. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #ifdef __FreeBSD__ #include #endif #include #include #include #include #include #include #include #if 0 #include #endif #ifdef __FreeBSD__ #define SBSIZE SBLOCKSIZE #endif #define SBCOUNT 64 /* XXX - Should be configurable */ /* Flags to control ourselves... */ #define FLAG_VERBOSE 1 #define FLAG_SMART 2 #define FLAG_LABELS 4 int ufsscan(int fd, daddr_t beg, daddr_t end, int flags) { static char lastmount[MAXMNTLEN]; static u_int8_t buf[SBSIZE * SBCOUNT]; struct fs *sb; daddr_t blk, lastblk; int n; lastblk = -1; memset(lastmount, 0, MAXMNTLEN); for (blk = beg; blk <= ((end<0)?blk:end); blk += (SBCOUNT*SBSIZE/512)){ memset(buf, 0, SBSIZE * SBCOUNT); if (lseek(fd, (off_t)blk * 512, SEEK_SET) < 0) err(1, "lseek"); if (read(fd, buf, SBSIZE * SBCOUNT) < 0) err(1, "read"); for (n = 0; n < (SBSIZE * SBCOUNT); n += 512){ sb = (struct fs*)(&buf[n]); if ((sb->fs_magic == FS_UFS1_MAGIC) || (sb->fs_magic == FS_UFS2_MAGIC)) { if (flags & FLAG_VERBOSE) printf("block %d id %x,%x size %d\n", blk + (n/512), sb->fs_id[0], sb->fs_id[1], sb->fs_size); if (((blk+(n/512)) - lastblk) == (SBSIZE/512)) { if (flags & FLAG_LABELS ) { #ifdef __FreeBSD__ printf("X: %lld %lld 4.2BSD %ld %ld %ld # %s\n", #else printf("X: %d %d 4.2BSD %d %d %d # %s\n", #endif (daddr_t)((off_t)sb->fs_size * sb->fs_fsize / 512), blk+(n/512)-(2*SBSIZE/512), sb->fs_fsize, sb->fs_bsize, sb->fs_old_cpg, lastmount); } else { #ifdef __FreeBSD__ printf("ufs1 at %lld size %lld mount %s time %s\n", #else printf("ffs1 at %d size %lld mount %s time %s\n", #endif blk+(n/512)-(2*SBSIZE/512), (long long)(off_t)sb->fs_size * sb->fs_fsize, lastmount, ctime((time_t *)&sb->fs_time)); } if (flags & FLAG_SMART) { off_t size = (off_t)sb->fs_size * sb->fs_fsize; if ((n + size) < (SBSIZE * SBCOUNT)) n += size; else { blk += (size/512 - (SBCOUNT*SBCOUNT)); break; } } } /* Update last potential FS SBs seen */ lastblk = blk + (n/512); memcpy(lastmount, sb->fs_fsmnt, MAXMNTLEN); } } } return(0); } void usage(int code) { extern char *__progname; fprintf(stderr, "usage: %s [-lsv] [-b begin] [-e end] device\n", __progname); exit(code); } int main(int argc, char *argv[]) { #ifdef __FreeBSD__ char *name; #endif int ch, fd, flags = 0; daddr_t beg = 0, end = -1; while ((ch = getopt(argc, argv, "lsvb:e:")) != -1) switch(ch) { case 'b': beg = atoi(optarg); break; case 'e': end = atoi(optarg); break; case 'v': flags |= FLAG_VERBOSE; break; case 's': flags |= FLAG_SMART; break; case 'l': flags |= FLAG_LABELS; break; default: usage(1); /* NOTREACHED */ } argc -= optind; argv += optind; if (argc != 1) usage(1); #ifdef __FreeBSD__ if (argv[0][0] != '/') { if (asprintf(&name, "/dev/%s", argv[0]) == -1) err(1, "%s", argv[1]); } else name = argv[0]; fd = open(name, O_RDONLY); #else fd = opendev(argv[0], O_RDONLY, OPENDEV_PART, NULL); #endif if (fd < 0) err(1, "%s", argv[1]); #ifdef __FreeBSD__ if (name != argv[0]) free(name); #endif return (ufsscan(fd, beg, end, flags)); } --Boundary-00=_MU/U+5seNB+VrtY-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Wed Feb 19 14:46:10 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F39D437B401 for ; Wed, 19 Feb 2003 14:46:08 -0800 (PST) Received: from smtp.inode.at (goliath.inode.at [195.58.161.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BD4A43F75 for ; Wed, 19 Feb 2003 14:46:08 -0800 (PST) (envelope-from mranner@inode.at) Received: from line101.adsl-dynamic.inode.at ([213.229.7.101]) by smtp.inode.at with esmtp (Exim 3.34 #1) id 18lcyc-0002fw-00; Wed, 19 Feb 2003 23:46:06 +0100 From: Michael Ranner To: freebsd-fs@freebsd.org Subject: Re: scan_ffs for UFS2 Date: Wed, 19 Feb 2003 23:45:58 +0100 User-Agent: KMail/1.5 References: <200302192220.12731.mranner@inode.at> <20030219212815.GY319@geekpunk.net> In-Reply-To: <20030219212815.GY319@geekpunk.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200302192345.58891.mranner@inode.at> Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Am Mittwoch, 19. Februar 2003 22:28 schrieben Sie: > [ Originally crossposted to -hackers and -fs. This reply Bcc'd to > -hackers, followups to -fs. ] > > On Wed, Feb 19, 2003 at 10:20:12PM +0100, Michael Ranner wrote: > > Scan_ffs is a system tool from OpenBSD to recover erased disklabels > > from your hard drive. > > Forgive me if I'm being dense, but what features does scan_ffs provide > that are not a subset of the features provided by gpart[0]? > > Seems like a duplicate wheel to me. > > [0] - http://www.stud.uni-hannover.de/user/76201/gpart/ or [1] > [1] - ports/sysutils/gpart No, absolute no. Ok I hear from gpart for the first time, but gpart ist GPL and cannot placed in the base distribution. Scan_ffs is a standard tool from the OpenBSD distribution and BSD license. I dont know if gpart does recognize UFS2 superblocks or if gpart is able to recover the BSD disklabel. Regards /\/\ichael Ranner mranner@jawa.at - mranner@bitonline.cc - webmaster@mariazell.at ---------------------------------------------------------------------- JAWA Management Software GmbH - http://www.jawa.at/ Liebenauer Hauptstrasse 2oo - A-8041 Graz Tel +43 316 403274 21 - Fax +43 316 403274 10 ---------------------------------------------------------------------- Mariazell Online - http://www.mariazell.at/ ---------------------------------------------------------------------- -----BEGIN GEEK CODE BLOCK----- GIT/CS/AT dx(-) s+:(++:) a- C++ UBLVS++++$ P++>+++$ L-(+)$ E--- W+++$ N+(++) o-- K- w--()$ O-(--) M@ V-(--) PS+>++ PE(-) Y+ PGP(-) t+ 5+ X+++(++++) R* tv++ b+(++) DI++ D-(--) G- e h--(*) r++ y? ------END GEEK CODE BLOCK------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Wed Feb 19 14:53:49 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE47337B401; Wed, 19 Feb 2003 14:53:41 -0800 (PST) Received: from smtp.inode.at (goliath.inode.at [195.58.161.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id C41CD43F3F; Wed, 19 Feb 2003 14:53:40 -0800 (PST) (envelope-from mranner@inode.at) Received: from line101.adsl-dynamic.inode.at ([213.229.7.101]) by smtp.inode.at with esmtp (Exim 3.34 #1) id 18ld5u-0003Em-00; Wed, 19 Feb 2003 23:53:38 +0100 From: Michael Ranner To: freebsd-fs@freebsd.org Subject: Re: scan_ffs for UFS2 Date: Wed, 19 Feb 2003 23:53:30 +0100 User-Agent: KMail/1.5 References: <200302192220.12731.mranner@inode.at> In-Reply-To: <200302192220.12731.mranner@inode.at> MIME-Version: 1.0 Message-Id: <200302192351.59267.mranner@inode.at> Cc: freebsd-hackers@freebsd.org Content-Type: Multipart/Mixed; boundary="Boundary-00=_qrAV+wBiKCp/hcI" Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --Boundary-00=_qrAV+wBiKCp/hcI Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Am Mittwoch, 19. Februar 2003 22:20 schrieb Michael Ranner: > Hello! > > I am trying to learn scan_ffs (original from OpenBSD, ported to FreeBSD > by Robert Watson) about UFS2 on 5-CURRENT, but it will not find the > Superblock and I dont understand exactly both for loops, especially > that 512 byte increment. > Ok, now scan_ffs can detect a UFS2 filesystem, but scan_ffs does not calculate the correct offset for the disklabel. Further I do not unterstand the "smart" feature of scan_ffs fully at the moment. Where to I find CPG in an UFS2 superblock? How can I detect, if scan_ffs should display fs_old_cpg or the new cpg value. Which fields hold the new cpg value in the superblock? Regards, -- /\/\ichael Ranner mranner@jawa.at - mranner@bitonline.cc - webmaster@mariazell.at ---------------------------------------------------------------------- JAWA Management Software GmbH - http://www.jawa.at/ Liebenauer Hauptstrasse 2oo - A-8041 Graz Tel +43 316 403274 21 - Fax +43 316 403274 10 ---------------------------------------------------------------------- Mariazell Online - http://www.mariazell.at/ ---------------------------------------------------------------------- -----BEGIN GEEK CODE BLOCK----- GIT/CS/AT dx(-) s+:(++:) a- C++ UBLVS++++$ P++>+++$ L-(+)$ E--- W+++$ N+(++) o-- K- w--()$ O-(--) M@ V-(--) PS+>++ PE(-) Y+ PGP(-) t+ 5+ X+++(++++) R* tv++ b+(++) DI++ D-(--) G- e h--(*) r++ y? ------END GEEK CODE BLOCK------ --Boundary-00=_qrAV+wBiKCp/hcI Content-Type: text/x-csrc; charset="iso-8859-1"; name="scan_ffs.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="scan_ffs.c" /* $OpenBSD: scan_ffs.c,v 1.8 2002/07/03 22:32:33 deraadt Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Tobias Weingartner. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #ifdef __FreeBSD__ #include #endif #include #include #include #include #include #include #include #if 0 #include #endif #ifdef __FreeBSD__ #define SBSIZE SBLOCKSIZE #endif #define SBCOUNT 64 /* XXX - Should be configurable */ /* Flags to control ourselves... */ #define FLAG_VERBOSE 1 #define FLAG_SMART 2 #define FLAG_LABELS 4 int ufsscan(int fd, daddr_t beg, daddr_t end, int flags) { static char lastmount[MAXMNTLEN]; static u_int8_t buf[SBSIZE * SBCOUNT]; struct fs *sb; daddr_t blk, lastblk; int n; #ifdef __FreeBSD__ int ufs; #endif lastblk = -1; memset(lastmount, 0, MAXMNTLEN); for (blk = beg; blk <= ((end<0)?blk:end); blk += (SBCOUNT*SBSIZE/512)){ memset(buf, 0, SBSIZE * SBCOUNT); if (lseek(fd, (off_t)blk * 512, SEEK_SET) < 0) err(1, "lseek"); if (read(fd, buf, SBSIZE * SBCOUNT) < 0) err(1, "read"); for (n = 0; n < (SBSIZE * SBCOUNT); n += 512){ #ifdef __FreeBSD__ ufs = 0; #endif sb = (struct fs*)(&buf[n]); #ifdef __FreeBSD__ if (sb->fs_magic == FS_UFS1_MAGIC) ufs = 1; if (sb->fs_magic == FS_UFS2_MAGIC) ufs = 2; if (ufs > 0) { #else if (sb->fs_magic == FS_MAGIC) #endif if (flags & FLAG_VERBOSE) printf("block %d id %x,%x size %d\n", blk + (n/512), sb->fs_id[0], sb->fs_id[1], sb->fs_size); #ifdef __FreeBSD__ if (((blk+(n/512)) - lastblk) == (SBSIZE*ufs/512)) { #else if (((blk+(n/512)) - lastblk) == (SBSIZE/512)) { #endif if (flags & FLAG_LABELS ) { #ifdef __FreeBSD__ printf("X: %lld %lld 4.2BSD %ld %ld %ld # %s\n", #else printf("X: %d %d 4.2BSD %d %d %d # %s\n", #endif (daddr_t)((off_t)sb->fs_size * sb->fs_fsize / 512), blk+(n/512)-(2*SBSIZE/512), sb->fs_fsize, sb->fs_bsize, #ifdef __FreeBSD__ sb->fs_old_cpg, lastmount); } else { printf("ufs%d at %lld size %lld mount %s time %s\n", ufs, #else sb->fs_cpg, lastmount); } else { printf("ffs at %d size %lld mount %s time %s\n", #endif blk+(n/512)-(2*SBSIZE/512), (long long)(off_t)sb->fs_size * sb->fs_fsize, lastmount, ctime((time_t *)&sb->fs_time)); } if (flags & FLAG_SMART) { off_t size = (off_t)sb->fs_size * sb->fs_fsize; if ((n + size) < (SBSIZE * SBCOUNT)) n += size; else { blk += (size/512 - (SBCOUNT*SBCOUNT)); break; } } } /* Update last potential FS SBs seen */ lastblk = blk + (n/512); memcpy(lastmount, sb->fs_fsmnt, MAXMNTLEN); } } } return(0); } void usage(int code) { extern char *__progname; fprintf(stderr, "usage: %s [-lsv] [-b begin] [-e end] device\n", __progname); exit(code); } int main(int argc, char *argv[]) { #ifdef __FreeBSD__ char *name; #endif int ch, fd, flags = 0; daddr_t beg = 0, end = -1; while ((ch = getopt(argc, argv, "lsvb:e:")) != -1) switch(ch) { case 'b': beg = atoi(optarg); break; case 'e': end = atoi(optarg); break; case 'v': flags |= FLAG_VERBOSE; break; case 's': flags |= FLAG_SMART; break; case 'l': flags |= FLAG_LABELS; break; default: usage(1); /* NOTREACHED */ } argc -= optind; argv += optind; if (argc != 1) usage(1); #ifdef __FreeBSD__ if (argv[0][0] != '/') { if (asprintf(&name, "/dev/%s", argv[0]) == -1) err(1, "%s", argv[1]); } else name = argv[0]; fd = open(name, O_RDONLY); #else fd = opendev(argv[0], O_RDONLY, OPENDEV_PART, NULL); #endif if (fd < 0) err(1, "%s", argv[1]); #ifdef __FreeBSD__ if (name != argv[0]) free(name); #endif return (ufsscan(fd, beg, end, flags)); } --Boundary-00=_qrAV+wBiKCp/hcI-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Wed Feb 19 18:24:54 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA24337B401; Wed, 19 Feb 2003 18:24:53 -0800 (PST) Received: from geekpunk.net (adsl-32-193-54.bna.bellsouth.net [67.32.193.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id B43B443F85; Wed, 19 Feb 2003 18:24:52 -0800 (PST) (envelope-from bandix@geekpunk.net) Received: from localhost.my.domain (taran [127.0.0.1]) by geekpunk.net (8.12.6/8.12.6) with ESMTP id h1JLSGvv012550; Wed, 19 Feb 2003 15:28:16 -0600 (CST) (envelope-from bandix@geekpunk.net) Received: (from bandix@localhost) by localhost.my.domain (8.12.6/8.12.6/Submit) id h1JLSFSY012549; Wed, 19 Feb 2003 15:28:15 -0600 (CST) (envelope-from bandix) Date: Wed, 19 Feb 2003 15:28:15 -0600 From: "Brandon D. Valentine" To: Michael Ranner Cc: freebsd-fs@freebsd.org Subject: Re: scan_ffs for UFS2 Message-ID: <20030219212815.GY319@geekpunk.net> References: <200302192220.12731.mranner@inode.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302192220.12731.mranner@inode.at> User-Agent: Mutt/1.4i Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org [ Originally crossposted to -hackers and -fs. This reply Bcc'd to -hackers, followups to -fs. ] On Wed, Feb 19, 2003 at 10:20:12PM +0100, Michael Ranner wrote: > Scan_ffs is a system tool from OpenBSD to recover erased disklabels > from your hard drive. Forgive me if I'm being dense, but what features does scan_ffs provide that are not a subset of the features provided by gpart[0]? Seems like a duplicate wheel to me. [0] - http://www.stud.uni-hannover.de/user/76201/gpart/ or [1] [1] - ports/sysutils/gpart Brandon D. Valentine -- brandon@dvalentine.com http://www.geekpunk.net "We've been raised on replicas of fake and winding roads, and day after day up on this beautiful stage we've been playing tambourine for minimum wage, but we are real; I know we are real." -- David Berman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message From owner-freebsd-fs Fri Feb 21 13:38:21 2003 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F3AC37B406; Fri, 21 Feb 2003 13:38:20 -0800 (PST) Received: from smtp1.server.rpi.edu (smtp1.server.rpi.edu [128.113.2.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F7C043FDF; Fri, 21 Feb 2003 13:38:19 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp1.server.rpi.edu (8.12.7/8.12.7) with ESMTP id h1LLcI3q019166; Fri, 21 Feb 2003 16:38:18 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <200302192220.12731.mranner@inode.at> References: <200302192220.12731.mranner@inode.at> Date: Fri, 21 Feb 2003 16:38:17 -0500 To: Michael Ranner , freebsd-fs@FreeBSD.ORG From: Garance A Drosihn Subject: Re: scan_ffs for UFS2 Cc: freebsd-hackers@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-RPI-Spam-Score: -0.5 () IN_REP_TO,REFERENCES,SIGNATURE_SHORT_DENSE,SPAM_PHRASE_03_05 X-Scanned-By: MIMEDefang 2.28 Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org At 10:20 PM +0100 2/19/03, Michael Ranner wrote: >Hello! > >I am trying to learn scan_ffs (original from OpenBSD, ported to >FreeBSD by Robert Watson) about UFS2 on 5-CURRENT, but it will >not find the Superblock and I dont understand exactly both for >loops, especially that 512 byte increment. > >Scan_ffs is a system tool from OpenBSD to recover erased disklabels >from your hard drive. > >Thanks for your input. For what it's worth, we (FreeBSD) have a simple SuperBlock recovery program in /usr/src/tools/tools/find-sb. I picked up some updates from Dave Cross for that, and have a few more of my own. I just have to sit down and get them all together into a single version. I don't know how find-sb compares to the program you're talking about, but they sound kind of similar. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message