reduce partition size. HELP
freebsd at edvax.de
Sat Dec 31 16:15:41 UTC 2011
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! :-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions