Addming space to /opt/

Hello,

When I recently installed my OpenSuSE, I made a separate /home/ partition.

A lot of memory was added to this partition (90%), leaving only 20GB for the / directory, which includes /opt/.

Any package that I download from the software center gets installed into the /opt/ directory which is under the / directoy. Meaning, I have already used about 70% of the memory.

Is there a possibility to give more space/memory to the /opt/ directory, possibly taking it from the /home/ directory which has an overkill of memory available to it?

Thanks in advance,
Drmota

That’s not good. Which Software Centre are we speaking about? Hardly anything installs on /opt. Yep, it’s possible to shrink /home, create a separate partition, mount that temporarily in /mnt, copy over contents of /opt, then unmount it and remount it in /opt.

And to point out: it’s not memory (generally used for RAM), it’s storage space.

Another way would be to copy /opt to say /home/opt and then replace /opt with a symlink to /home/opt.

Hellodrmota,

Welcome here (I see this is your first post).

Like @Knurpht I wonder what software is going in* /opt* and where you got that from. In fact the only thing I find in my /opt is some old KDE3 stuff (I guess I can remove that) and it is only 352 KByte, hardly something to worry about.

OTOH when installed software from the openSUSE repos, it goes into all sorts of places like* /bin*,* /lib, /usr*, /etc and those are normaly all part of the / file system and thus fill up the same. For me (and for most people here) a root (/) file system of 20GB is adequate enough (mine is 26% of 2GB). But when you want to use your system for software that is not used by the mainstream of users and that is very big in installed size, you should plan for that at system installation of course. Curing this later by resiziing or placing elsewhere (with links) can be done as others allready point to.

Hey guys,

Thanks for your replies!

My problem is that I just installed Google Chrome from the Software Package Manager and it installed into my opt/ directory.

Another problem that occurs to me is, in my previous linux distributions, namely Ubunut, when I installed lampp apache service, it automatically installed in and configured in the /opt/ directory, which is under the / directory. Therefore, whole MySQL databases and scripts are saved in the ‘little space available’ / directory rather than filling up the /home/ directory. Would a symlink from /opt/ to /home/opt/ fix this?

If I replace /opt/ with a symlink to /home/opt/ won’t that just create a shortcut of /home/opt/ and still take up the space?

Thanks
Drmota

The files live in /home and so take up space there, not in /.

Do you mean that you have still the LAMPP server running from the places where Ubuntu put them instead of the LAMPP software from the openSUSE repos and where openSUSE put them? This makes it a bit difficult to maintain it I guess. And a bit difficult for us to tell you exactly what to do and where to find things, simpy because you have them somewhere else.

Also in the openSUSE MySQL, the database is somewhere in /var/lib/mysql/ (wich of course is normaly also inside the root partition). But when you tell MySQL to create the database elsewehere, it will put te data there and create the symlink inside* /var* itself.

I do this by using

CREATE TABLE boek (
...
...
...       )
        DATA DIRECTORY = '/home/databases/reisboeken'
        INDEX DIRECTORY = '/home/databases/reisboeken';


Then MySQL creates:

boven:/var/lib/mysql/reisboeken # l
total 44
drwx------ 2 mysql mysql  4096 May 26  2011 ./
drwxr-x--- 8 mysql mysql 20480 Jan  6 10:20 ../
lrwxrwxrwx 1 mysql mysql    35 May 26  2011 boek.MYD -> /home/databases/reisboeken/boek.MYD
lrwxrwxrwx 1 mysql mysql    35 May 26  2011 boek.MYI -> /home/databases/reisboeken/boek.MYI
-rw-rw---- 1 mysql mysql  8878 May 26  2011 boek.frm
-rw-rw---- 1 mysql mysql    61 May 26  2011 db.opt
boven:/var/lib/mysql/reisboeken # 

and thus the real bulky database data is in* /home/databases/*. Which has (for me) the advantage that it is saved together with the other users home directory data.

I am not sure, but I deduct from this that you link the wrong way.

. Check that you have a good, up-to-date backup of at least /opt (better of your whoe syssem of course)

. Be sure that all in */opt *is not used (by going to runlevel 1 or so);

. create /home/opt

mkdir /home/opt

and set all the access bits and the owner/group the same as those of /opt;

. remove /opt (This statement is to be used very carefully, nobody should try this “just for fun” on his system, at least I will not come to your rescue)

rm -rf /opt

create the link

ln -s /home/opt /opt

. Check if all in */opt *can be found.

I assume you mean the OP, not me. I certainly know which way my symlinks point. :wink:

. Check that you have a good, up-to-date backup of at least /opt (better of your whoe syssem of course)

. Be sure that all in */opt *is not used (by going to runlevel 1 or so);

. create /home/opt

mkdir /home/opt

and set all the access bits and the owner/group the same as those of /opt;

I think you missed an important step here, i.e. to copy the contents of /opt to /home/opt. This will take care of creating, copying, and ownership in one go. You can skip the delete step as there won’t be anything to delete after the move.

mv /opt /home

Yes, mv knows how to move entire directories from filesystem to filesystem by copy and delete. But don’t interrupt it, or you will have half here and half there, then you will have to reach for the backup.

. remove /opt (This statement is to be used very carefully, nobody should try this “just for fun” on his system, at least I will not come to your rescue)

rm -rf /opt

create the link

ln -s /home/opt /opt

. Check if all in */opt *can be found.

I plead guilty :shame:

First I cited the wrong post, yours instead of the OP’s. It was he who said

If I replace /opt/ with a symlink to /home/opt/ won’t that just create a shortcut of /home/opt/ and still take up the space?

Which show imho that he does not understand to much about symlinks.

Second, I forgot to move the data. But I made a backup before starting the action. lol!

And maybe the best way to do these sort of actions is not even from runlevel 1 (or s), but from a live CD, rescue CD or the like.

It should be safe to run from a normal runlevel if no processes are using files in /opt. You could do:

lsof | grep /opt

On my system, only chrome is running out of /opt.

But maybe this advice confuses beginners even more. :frowning:

That is correct, but as he says he has a lot in /opt and even his databse, his situation might be different then we are used to.

On 2012-01-06 14:46, hcvv wrote:

> That is correct, but as he says he has a lot in /opt and even his
> databse, his situation might be different then we are used to.

Not really :slight_smile:

He appears to have two partitions, the standard root and home. Root is only
20 GiB. It doesn’t matter if his software goes to /opt, because otherwise
it would go to /usr, or if his databases are also /opt, because normally
they would be in /var. All those places are on the root partition, so it
does not matter where they are in fact. Nothing goes to home.

Yes, the symlink solution is the easier one, after learning which directory
to do.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Of course, when he has a* /* and* /home* partion, it does not matter where things go when you talk about the size. pointed several times to that above. But the OP explicitly says that a lot of things are in* /opt* (that is why he started this thread), which is not typical for an openSUSE system. He also say in post #5 above that he has a sort of Ubuntu LAMP installation in his openSUSE and that a lot of things “thus” are in* /opt*,** even his database**! (I take his word in this becuse I have no Ubuntu expoerience).

And that made me:
a) warn the OP to study the value of any anwers he get from here, because those answers may be based on and openSUSE LAMP situation;
b) try to let him do a move of /opt contents while running almost nothing because when his MySQL database is in /opt (instead of in* /var* which is the openSUSE default) then not using chrome is not enough to free /opt from activities.