From owner-freebsd-questions@FreeBSD.ORG Sat Dec 31 16:15:41 2011 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 18C34106564A for ; Sat, 31 Dec 2011 16:15:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id C73F48FC14 for ; Sat, 31 Dec 2011 16:15:40 +0000 (UTC) Received: from r56.edvax.de (port-92-195-26-82.dynamic.qsc.de [92.195.26.82]) by mx02.qsc.de (Postfix) with ESMTP id 2BE181DC45; Sat, 31 Dec 2011 17:15:39 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id pBVGFc20002008; Sat, 31 Dec 2011 17:15:38 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sat, 31 Dec 2011 17:15:38 +0100 From: Polytropon To: Warren Block Message-Id: <20111231171538.fd1156fb.freebsd@edvax.de> In-Reply-To: References: <211353632.20111231040344@yandex.ru> <20222.32401.326222.536203@jerusalem.litteratus.org> <1112244537.20111231112327@yandex.ru> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: =?UTF-8?Q?=D0=9A=D0=BE=D0=BD=D1=8C=D0=BA=D0=BE=D0=B2_=D0=95=D0=B2?=, =?UTF-8?Q?=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= , Robert Huff , freebsd-questions@freebsd.org Subject: Re: reduce partition size. HELP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2011 16:15:41 -0000 On Sat, 31 Dec 2011 08:45:32 -0700 (MST), Warren Block wrote: > On Sat, 31 Dec 2011, ??????? ??????? wrote: > > > ????????????, Robert. > > > > ?? ?????? 31 ??????? 2011 ?., 5:16:33: > > > > > > RH> =?windows-1251?B?yu7t/Oru4iDF4uPl7ejp?= writes: > > > >>> Is there any way to reduce partition size on live system? > > > > RH> No. > > RH> Basic steps: > > RH> 0) go to single-user; unmount partition > > RH> 1) backup affected partition; test backup > > RH> 2) delete old partition > > RH> 3) create new/smaller partition > > RH> 4) restore from backup > > > > is there a way to goto singe-user through ssh? > > Single-user and unmounted partitions are desirable but not required. > See dump(8) about the -L option. Of course. And in addition, how about that? NOT TESTED! READ *FULLY* BEFORE DOING ANYTHING! For this example, /dev/ad0s1a is the / partition. There are other partitions (such as /var or /home) associated to other device files. Let's also assume /dev/ad0s1e is the /var partition. Onto the /var partition (or /home or any scratch oartition), copy the content from / (primarily because of /sbin, /bin and maybe /etc); maybe use this approach: # cd /var # dump -0 -L -a -u -f - /dev/ad0s1a | restore -r -f - Make sure /var does _not_ contain directory names identical to those found on the / partition! As I said, maybe use /scratch. :-) (Oh, and you can of course shorten the dump parameters to -0Lauf and restore's to -rf, but I chose this representation for making implicitely clear why to use _those_ options.) Then umount / and mount /var (I'll keep this for the example) as the new / (which now has all the things / should have): # umount /var # umount -f / ; mount -t ufs /dev/ad0s1e / Then the device associated to / should be free to be unmounted - a step desirable, but it should be no a "big" problem to operate on the device files associated with a _mounted_ partition. The more I think about it... /var is a really bad choice. Use /scratch, or at least /home. AGAIN: NOT TESTED! MAY BLOWENFUSEN & CORKENPOPPEN! :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...