Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2011 17:15:38 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Warren Block <wblock@wonkity.com>
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?= <kes-kes@yandex.ru>, Robert Huff <roberthuff@rcn.com>, freebsd-questions@freebsd.org
Subject:   Re: reduce partition size. HELP
Message-ID:  <20111231171538.fd1156fb.freebsd@edvax.de>
In-Reply-To: <alpine.BSF.2.00.1112310841430.50853@wonkity.com>
References:  <211353632.20111231040344@yandex.ru> <20222.32401.326222.536203@jerusalem.litteratus.org> <1112244537.20111231112327@yandex.ru> <alpine.BSF.2.00.1112310841430.50853@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111231171538.fd1156fb.freebsd>