From owner-freebsd-sysinstall@FreeBSD.ORG Fri Aug 30 12:46:50 2013 Return-Path: Delivered-To: freebsd-sysinstall@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F03ACE7E; Fri, 30 Aug 2013 12:46:50 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 860A22190; Fri, 30 Aug 2013 12:46:50 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.7/8.14.7) with ESMTP id r7UCkmxm097119; Fri, 30 Aug 2013 06:46:48 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.7/8.14.7/Submit) with ESMTP id r7UCkmZ3097116; Fri, 30 Aug 2013 06:46:48 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 30 Aug 2013 06:46:48 -0600 (MDT) From: Warren Block To: Nathan Whitehorn Subject: Re: Bug in bsdinstall (fs found where not present) In-Reply-To: <52200CEB.9030101@freebsd.org> Message-ID: References: <521FBC34.4070604@freebsd.org> <52200CEB.9030101@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Fri, 30 Aug 2013 06:46:48 -0600 (MDT) Cc: freebsd-sysinstall@FreeBSD.org X-BeenThere: freebsd-sysinstall@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Sysinstall Work List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Aug 2013 12:46:51 -0000 On Thu, 29 Aug 2013, Nathan Whitehorn wrote: > On 08/29/13 17:02, Warren Block wrote: >> On Thu, 29 Aug 2013, Nathan Whitehorn wrote: >> >>> On 08/29/13 14:04, Warren Block wrote: >>>>> From a 9.2-PRERELEASE snapshot, go into the shell, create a GPT disk >>>> layout with a bunch of partitions for filesystems and swap. Exit the >>>> shell and run the installer. >>>> >>>> Go through each partition setting a mount point. Tell bsdinstall to >>>> continue. It reports that the / partition has a preexisting >>>> filesystem (it does not, in fact; this disk had a mishmash of MBR and >>>> NTFS on it). >>>> >>>> Tell bsdinstall to continue anyway. It does, and then reports that it >>>> can't mount /dev/ada0p2 on /mnt, presumably because, contrary to the >>>> misleading and incorrect error message, there is no filesystem on >>>> there. >>>> >>>> The install fails, try again, entering all the mount points, and it >>>> will fail the same. >>>> >>>> Short term solution: newfs the / partition, so there really is a >>>> filesystem there for bsdinstall to detect and warn about. Then it >>>> works. >>> >>> bsdinstall has no way to detect whether or not you already have UFS in a >>> freebsd-ufs file system. It assumes, when not given contrary >>> information, that a partition that exists is initialized. There does not >>> seem to be a way around this. If you have any ideas, those would of >>> course be helpful. >> >> file(1) works well for detecting filesystems. >> >> For that matter, what is bsdinstall doing now that makes it say there >> is a filesystem on a partition? Maybe the message is misleading. > > What that actually means is that the partition exists. (file doesn't > work on block devices, by the way) -s is needed for special files: # file -s /dev/ada0p2 /dev/ada0p2: Unix Fast File system [v2] (little-endian) last mounted ... To identify some common cases, I've been using this for a while: # return a file type string for a devnode fstype () { case `file -s $1 | egrep -o 'FAT|NTFS|EXT2|ISO 9660|Unix Fast File system' | tr ' ' _` in FAT*) printf "msdosfs" ;; NTFS*) printf "ntfs" ;; EXT2*) printf "ext2fs" ;; ISO_9660*) printf "cd9660" ;; Unix_Fast_File_system*) printf "ufs" ;; esac }