From owner-freebsd-questions@FreeBSD.ORG Thu Mar 18 10:25:20 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCA20106566C for ; Thu, 18 Mar 2010 10:25:20 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id A40D58FC12 for ; Thu, 18 Mar 2010 10:25:19 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.187.76.163]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.4/8.14.4) with ESMTP id o2IAJKbL032067 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 18 Mar 2010 10:19:20 GMT (envelope-from m.seaman@infracaninophile.co.uk) Message-ID: <4BA1FE27.10005@infracaninophile.co.uk> Date: Thu, 18 Mar 2010 10:19:19 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: =?UTF-8?B?0JDQvdGC0L7QvSDQmtC70LXRgdGB?= References: <4BA1F42C.1030607@comclark.com> <3f1c29e71003180252g9d172dejc02f91fe874f5ea2@mail.gmail.com> In-Reply-To: <3f1c29e71003180252g9d172dejc02f91fe874f5ea2@mail.gmail.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.95.3 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, SPF_FAIL autolearn=no version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on happy-idiot-talk.infracaninophile.co.uk Cc: Aiza , FreeBSD Questions Subject: Re: shrink /usr size X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 10:25:21 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 18/03/2010 09:52:50, Антон Клесс wrote: > 2010/3/18 Aiza > >> /usr is the last partition in the slice. It has 15GB and only 600mb used. I >> would like to shrink /usr to 7GB leaving me 7GB for another new partition > The same question: how to extend existed one? If, and only if, you have free space on your HDD following the partition you want to expand, you can use bsdlabel to edit the partition table and then growfs(8) to extend the filesystem into the new space. > I'm going to change HDD on server to a bigger one and dd from old to new, > but in this case the space visible to FreeBSD would be the same, how to make > it grow? However, in this case -- don't do that. dd(1) is not the best choice. Instead, use sade(8) or fdisk(8) and bsdlabel(8) to slice and partition your new hard drive, install any necessary boot blocks etc. Or use the new gpart(8) stuff. Create filesystems using newfs(1). Mount the new partitions temporarily under /mnt: # mount -t ufs -o rw /dev/ad2s1a /mnt # mount -t ufs -o rw /dev/ad2s1e /mnt/usr (etc...) Then use dump(8) and restore(8) to duplicate the contents of your old partitions onto your new HDD: # dump -0a -L -C 32 -f - / | ( cd /mnt ; restore -rf - ) # dump -0a -L -C 32 -f - /usr | ( cd /mnt/usr ; restore -rf - ) (etc...) Edit /mnt/etc/fstab appropriately, then unmount the partitions from your new HDD, shutdown your system and reboot from the new HDD. dump and restore is much more efficient than using dd(1) as it copies the actual files into a new filesystem. It also understands more about the internals of the filesystem than other backup software, so gives the most accurate duplication. The '-L' flag causes it to operate on a snapshot of the source filesystem, which avoids the sort of problems you can get dealing with live filesystems. Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuh/icACgkQ8Mjk52CukIwS1wCfc3hdbwoagHNDKA3nY+wDZ9ar f+YAn1J0CJrdkhKVuGInl7TixLsUqQ+7 =BOC0 -----END PGP SIGNATURE-----