From owner-freebsd-arm@FreeBSD.ORG Mon May 5 17:08:58 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 586E3B5B for ; Mon, 5 May 2014 17:08:58 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 35D596AA for ; Mon, 5 May 2014 17:08:57 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s45H8uHl050788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 May 2014 10:08:57 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s45H8uLa050787; Mon, 5 May 2014 10:08:56 -0700 (PDT) (envelope-from jmg) Date: Mon, 5 May 2014 10:08:56 -0700 From: John-Mark Gurney To: Paul Darius Subject: Re: partition resize Message-ID: <20140505170856.GQ43976@funkthat.com> Mail-Followup-To: Paul Darius , freebsd-arm References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Idd68gPqKLz5+Ci0" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 05 May 2014 10:08:57 -0700 (PDT) Cc: freebsd-arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2014 17:08:58 -0000 --Idd68gPqKLz5+Ci0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Paul Darius wrote this message on Sat, May 03, 2014 at 15:10 +0700: > hi there.. > > here is the partition created from the fbsd image > > $ gpart show > => 63 61497281 mmcsd0 MBR (29G) > 63 34776 1 !12 [active] (17M) > 34839 61462485 2 freebsd (29G) > 61497324 20 - free - (10K) > > => 0 1918278 mmcsd0s2 BSD (29G) > 0 1918278 1 freebsd-ufs (937M) This partition didn't grow for some reason... gpart resize -i 1 mmcsd0s2 Should grow it... > $ cat /etc/fstab > /dev/mmcsd0s1 /boot/msdos msdosfs rw,noatime 0 0 > /dev/mmcsd0s2a / ufs rw,noatime 1 1 > md /tmp mfs rw,noatime,-s30m 0 0 > md /var/log mfs rw,noatime,-s15m 0 0 > md /var/tmp mfs rw,noatime,-s5m 0 0 > > when I do extract the ports.tar.gz into /usr, I end up with file system full > > how do i know which partition for what and how to resize them ? > > the /etc/rc.d/autosize start give the result : > # /etc/rc.d/autosize start > Enlarging root partition > mmcsd0s2 resized > gpart: autofill: No space left on device > growfs: requested size 937MB is not larger than the current filesystem > size 937MB I just recently rewrote crochet's autosize/growfs rc.d script to be able to handle any partitioning scheme to grow /... You could try the attached... just run: "growfs start" and it should run all the necesssary commands... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." --Idd68gPqKLz5+Ci0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=growfs #!/bin/sh # PROVIDE: growfs # BEFORE: sysctl # KEYWORD: firstbootonly # Automatically grow / to fill the entire disk. # # This allows us to distribute a single image # and have it work on essentially any sized disk. # # TODO: Figure out a clean way to have this run # only on first boot. (We can't write anything to # disk here since the root disk is still mounted # read-only at this point.) Fortunately, it completes # very quickly if it can't actually grow the partition. # # TODO: Figure out where this should really be ordered. # I suspect it should go just after fsck but before mountcritlocal # but it's hard to tell for sure because of the bug described # below. # . /etc/rc.subr name="growfs" start_cmd="growfs_start" stop_cmd=":" rcvar="growfs_enable" growfs_start () { echo "Growing root partition to fill device" rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }') if [ x"$rootdev" = x"${rootdev%/*}" ]; then # raw device rawdev="$rootdev" else rawdev=$(glabel status | awk '$1 == "'"$rootdev"'" { print $3 }') if [ x"$rawdev" = x"" ]; then echo "Can't figure out device for: $rootdev" return fi fi sysctl -b kern.geom.conftxt | awk ' { lvl=$1 device[lvl] = $3 type[lvl] = $2 idx[lvl] = $7 if (dev == $3) { for (i = 1; i <= lvl; i++) { # resize if (type[i] == "PART") { pdev = device[i - 1] cmd[i] = "gpart resize -i " idx[i] " " pdev } else if (type[i] == "LABEL") { continue } else { print "unhandled type: " type[i] exit 1 } } for (i = 1; i <= lvl; i++) { if (cmd[i]) system(cmd[i]) } exit 0 } }' dev="$rawdev" growfs -y /dev/"$rootdev" } load_rc_config $name run_rc_command "$1" --Idd68gPqKLz5+Ci0--