Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 1998 07:39:33 -0400 (EDT)
From:      Spidey <beaupran@JSP.UMontreal.CA>
To:        "Jose M. Megias Sanchez" <jms@caja-granada.es>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: extend file system
Message-ID:  <Pine.BSF.3.96.980810070003.343A-100000@outpost.nada.org>
In-Reply-To: <01bdc436$5cc60000$00008282@jms>

next in thread | previous in thread | raw e-mail | index | archive | help
I really got to finish the paper I have to write on this...

Please, consider that I take ***no responsability*** to any damage this
procedure can do on your system. I only engage myself into helping you to
the best of my knowledge.

I wish that someone corrects me if I make any mistake. Don't start the
procedure in a hurry. Maybe you should wait for a second advice, such as
Julian Elisher or Greg Lehey...

On Mon, 10 Aug 1998, Jose M. Megias Sanchez wrote:

> Hello, I have a little problem. My fylesystem /usr is full and I would like
> to extend its size, in other unix (hp-ux) its too easy with the command
> extendfs but FreeBSD don't has it.

Indeed. It would be a quite great adding, if you ask me...

> I have the following fylesystems:
> mulhacen2# df -k
> Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
> /dev/sd0a      297423    18048   255582     7%    /
> /dev/sd0s2h   2244926       17  2065315     0%    /home
> /dev/sd0s2e    248175     3362   224959     1%    /tmp
> /dev/sd0s2f    496367   467706   -11048   102%    /usr
> /dev/sd0s2g    695311     2094   637593     0%    /var
> procfs              4        4        0   100%    /proc
> /dev/wcd0c     600108   600108        0   100%    /dist
> 
>     I would like extend /usr with 100 Mb catching the space from /home (by
> the moment not used). I have a backup of all fylesystems obtained with DUMP,
> How can I do now to extend /usr?, newfs -s maybe?. Regards.

i really don't think it is a solution. I did the thing. And it was
freespace that I was adding at the end of my /usr... All the stuff is on
disklabel.

1- Make sure your backups are OK... I don't know DUMP, but I know that it
is a risky procedure.

2- Check disklabel -r /dev/sd0s2. (you have 2.2.5R or lower uh?, or else
your sd0a would be sd0s2a, I think...:). With disklabel, you'll see the
size and offset of your partitions.

One problem is that your /var is after your /usr, which means we got to
make some room, which implies that you BACKUP /var, because it's gonna be
*deleted*.

'En resume': /var, /usr and /home will be deleted. Back them up. Double
check to see if you have the necessary software to restore these on
**other** partitions than these 3!!!

Then what you will do is, in single-user (not necessarly needed, but take
no chaces...), edit the disklabel with: 

disklabel -r -e /dev/sd0s2

You may need to mount certain filesystems, 'cause disklabel uses a text
editor (vi generally), and files in /tmp... In your case this shouldn't
be a problem, 'cause /tmp is on a seperate partition. However, *** make
sure you have vi under your path!!! ****

There is the 'fun part'... You edit the sizes and offsets as your
convenience. As I understood, you don't need to change the /var size, so
just add the size you're adding to /usr to the *offset* of /var.

You may also like to put /var *before* /usr, if you ever need (plan?) to
do this again, but this may imply things that I am noot aware of (fstab
changes etc...)

You'll also have to add the adding size to the offset of /home, and
substract it from the size of /home (to your calculators!!!! we don't want
any mistake here!!!)

Then:

newfs /dev/sd0s2f
newfs /dev/sd0s2g
newfs /dev/sd0s2h

This should give you the 3 new filesystems, empty, ready to be restored!

There is only oone thing I would be worried about. The -11000 blocks
"available"... I'm not sure as of how to handle this...

So, briefly this goes on like:

1- Backup /var /usr and /home.
2- Install necessary software on a 'neutral zone', let's say /.
   a- vi or another editor that will be in $EDITOR
   b- disklabel, newfs (I think it's already on /bin, but...)
   c- you might also like a fixit and install floppies, if something goes
wrong.
3- Go single-user, and mount necessary partitions. I don't think it would
be a very good idea to mount /var, /home or /usr... Try to avoid it.
4- disklabel -r -e /dev/sd0s2
5- Edit to it your needs.
   [optionnal]- Swap /var and /usr
6- Wish.
7- newfs /home , /var and /usr (don't use this syntax! :)
8- Restore the partitions.
9- Modify /etc/fstab if you swap /var and /usr.
10- Be happy.
11- Quickly fill up /usr
12- 'GOTO 1-' :)

Give me feedback!

Best luck!

Spidey

How 'bout a little ride through your own world? 
http://www.JSP.UMontreal.CA/~beaupran/




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980810070003.343A-100000>