From owner-freebsd-questions@FreeBSD.ORG Fri Dec 7 06:54:58 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61D123B8 for ; Fri, 7 Dec 2012 06:54:58 +0000 (UTC) (envelope-from jamebus@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id DF21C8FC0C for ; Fri, 7 Dec 2012 06:54:57 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id je9so64519bkc.13 for ; Thu, 06 Dec 2012 22:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=PmwMAYdaXXp+VHL2pAcNK4OicvRojvQYkZbNat0OZJs=; b=cxUf5bAwN6+Zqd22DA3DzjxifpcSmYrtLbbKRb++khbFgT18VMpvXSoX60eobCHx90 LGSVPux42JI5spnZZnA7hJy6xNOR/+T0R8aquSRPuZkijdk09zvm2IVIkyJ3xOd+Fc6R LXtdohY8cZPzHGJKDGnf1KVy7MSVlWOg5Hz1j+j4kB7GNNL91rZjJY9jIK98JoVh1WM+ GHoYqy6kUzdM0A55WpwcHz4+gYayn2254HWtM7Nny48TxtKwViPHHGvU9yvbVXhFhhnp jIs0ZEGjFgfhejE/H2Og7UJQltB/E0qBs/rufEyfeQmDr7A+JcvyRgDBqOH6/B/vC5Or kRcg== MIME-Version: 1.0 Received: by 10.204.152.28 with SMTP id e28mr1639188bkw.3.1354863296622; Thu, 06 Dec 2012 22:54:56 -0800 (PST) Sender: jamebus@gmail.com Received: by 10.204.34.204 with HTTP; Thu, 6 Dec 2012 22:54:56 -0800 (PST) In-Reply-To: <20121207062431.GA15665@hemlock.hydra> References: <50C1313C.4000201@gmx.com> <11844.1354839834@tristatelogic.com> <20121207062431.GA15665@hemlock.hydra> Date: Fri, 7 Dec 2012 00:54:56 -0600 X-Google-Sender-Auth: u4C9iDtNawGoffbN-Fc-G8PhnzM Message-ID: Subject: Re: List all hard drives on system (with capacities)... How? From: James To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2012 06:54:58 -0000 And because I think geom(8) and awk(1) are awesome... geom disk list | awk ' BEGIN { FS=": *" } $1 == "Geom name" { device=$2 } $1 ~ "^ +Mediasize$" { match($2, /\([^)]+\)/) size=substr($2, RSTART+1, RLENGTH-2) } $1 ~ "^ +descr$" { if ($2 == "(null)") { descr="UNKNOWN" } else { descr=$2 gsub(/ /, "_", descr) } } /^$/ { if (device !~ /^cd[0-9]+/) { printf "%s %s %s\n", device, size, descr } } ' This likely won't handle every possible device type available. Something very similar is serving me well thus far. HTH! -- James.