Increasing allocated space to a mount - possible?

Hey guys,

I am somewhat new to Solaris - and very new when it comes to mounts.

My problem is that when I installed Solaris, I allocated way too little diskspace to my / mount (it first became obvious now, however, because of new needs).

bash-3.00# df -h 
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d1s0        4.6G   3.9G   741M    85%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   933M   888K   932M     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.9G   741M    85%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G   107M   932M    11%    /tmp
swap                   932M    24K   932M     1%    /var/run
/dev/dsk/c0d1s7        224G   1.4G   221G     1%    /export/home

As you can see, I have lots of space allocated to /export/home.

My question is - can I (and how?) do I take 100 gb of space from /export/home and allocate to my / mount without literally screwing my system over?

The primary reason for this is that installing Oracle on my server requires at least 1,1-1,5 gb of available disk space on /. As you can see above, I only have 741 mb free disk space.

I hope you can point me in the right direction.
Please keep in mind that I never have played with mounts before on UNIX, so please be gentle :smiley:

It can be done, but not exatly in the way you describe it.

Can you post a

du -sk /*

So we can see to what directories your space is allocated on the root disk. There are obvious directories such as /var and /usr that can be moved to new partitions, but we need to be sure you aren't using /opt or similar directories heavily.

That sounds good. I am more than open for suggestions, if it can save me a reinstall ;o)

Here's the result of a du -sk /*:

bash-3.00# du -sk /*
6       /Desktop
1       /Documents
1       /bin
78453   /boot
34000   /core
646     /dev
120     /devices
63271   /etc
1411938 /export
0       /home
93865   /kernel
26280   /lib
8       /lost+found
1       /mnt
0       /net
397457  /opt
55907   /platform
790598  /proc
2       /rmdisk
1740    /sbin
6714    /system
109496  /tmp
1807    /u03
2647479 /usr
641947  /var
0       /vol

From this we see that /usr is (probably) created on the root filfesystem. And it's very big.

# df -k /usr
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2              5524368   4497236    741980  86% /

You should look at this

du -sk /usr/*

and perhaps move some stuff to /export (which is huge).

i.e.

cd /usr
mv _something_ /export
ln -s /export/_something_

(it's safer to do this when there are no users on the system, and maybe even from single user mode)

There's also other articles on the Forum about Solaris filesystems:

i.e.

That sounds interesting, Scott. Is there something in /usr/ that I should *not* move or can it all be moved safely to /export without corrupting any dependencies, links etc?

(I think you are absolutely right that it should be done from single user mode to be on the safe side).

Just for good manners, here's a du -sk /usr/*:

bash-3.00# du -sk /usr/*
1       /usr/5bin
1       /usr/X
107206  /usr/X11
1       /usr/X11R6
1       /usr/adm
53383   /usr/apache
16059   /usr/apache2
108642  /usr/appserver
140     /usr/aset
48898   /usr/bin
1831    /usr/ccs
6051    /usr/demo
1       /usr/dict
80643   /usr/dt
1       /usr/games
6       /usr/gnome
46092   /usr/include
89680   /usr/j2se
1       /usr/java
177537  /usr/jdk
3841    /usr/kernel
4       /usr/kvm
629267  /usr/lib
1       /usr/mail
1       /usr/man
5       /usr/net
1       /usr/news
24      /usr/oasys
1       /usr/old
206702  /usr/openwin
59155   /usr/perl5
29458   /usr/pgadmin3
1350    /usr/platform
95057   /usr/postgres
1       /usr/preserve
15      /usr/proc
1       /usr/pub
53162   /usr/sadm
19161   /usr/sbin
478344  /usr/sfw
303631  /usr/share
3427    /usr/snadm
1       /usr/spool
1       /usr/src
24183   /usr/sunvts
1       /usr/tmp
569     /usr/ucb
159     /usr/ucbinclude
564     /usr/ucblib
389     /usr/vmsys
2556    /usr/xpg4
429     /usr/xpg6

Provided you create a link in /usr to the new location in /export there shouldn't be anything you can't move.

I now tried to do the following sequence:

mkdir /export/usr
mv /usr/* /export/usr
/export/usr/bin/ln -s /export/usr usr
rm -rf /usr
/export/usr/bin/mv usr /

Since the ls, mv etc reside in /usr/bin, I had to add a little extra to be able to create the link, remove the old /usr and move the usr-link to /. So far, so good and I was again able to do things without /export/... stuff in front.

However, after rebooting this prevents me from doing anything but going into system maintenance mode. The errors did not make much sense, so I decided to boot it into failsafe since Solaris itself suggested it because there was some diffs in /.

In failsafe, I realized I couldn't really do much (at least, not to my knowledge). In failsafe, I had an empty /usr. I rebooted again and attempted to start in normal mode. It fails and prompting that Console login is not possible and forced me again to enter system maintenance mode.

However, since system maintenance mode is read only, I am wondering - can you enter system maintenance in write mode? The only thing I need to do (as far as I can see) to bring things back in order is to -

1) Delete the usr link in /
2) Create new /usr dir
3) Move all data from /export/usr to /usr.
4) Reboot

Any ideas?

Oh dear.

I could have been clearer.

Perhaps I should have said, "whatever you do, don't do this":

mkdir /export/usr
mv /usr/* /export/usr
/export/usr/bin/ln -s /export/usr usr
rm -rf /usr
/export/usr/bin/mv usr /

My suggestion was to move as much from /usr as you needed to free up enough space to install Oracle.

cd /usr
mv openwin appserver /export

My statement that "Provided you create a link in /usr to the new location in /export there shouldn't be anything you can't move.", isn't strictly true (/usr/bin/init for example is a link to ../../sbin/init which would no longer be valid for /export/usr/bin since sbin is in / and ../../init would refer to a file in /export and not /), but I certainly didn't mean you to create a new usr directory under export and move everything from /usr into it, or rm -rf /usr.

But I really should have been clearer. Feeling responsible, I did a similar thing on my Solaris - which is now broken. (/export/usr is empty and /usr is no longer there), so I've had to reinstall it.

If your usr directory exists somewhere and you are able to remount / read-write then you should be able to fix this without re-installing.

Once my Solaris is finished installing, I'll have another look.

It's quite okay, no worries - after all, it's still a whole lot of learning and I would never store critical data on a Solaris server before I get more confident in doing stuff like this, so we're never literally screwed :smiley:

However, I do have the complete contents of the usr directory. It's located now in /export/usr/. This means that if I can get write mode on the system maintenance, I will be able to restore the /usr directory.

Do you know what to do in order to be able to write stuff (move, create) while in maintenance mode?
When I attempt to do anything that would cause a read-operation on the disk, it says for example:

-bash-3.00# rm usr (attempting to delete usr link in /)
rm: usr not removed: Read-only file system

When i do a df -h to see what's on, we get (sorry for the horrible formatting, writting freehand since I can't SSH to the server atm :rolleyes:):

df -h
Filesystem size used avail capacity Mounted on
/pci@0,0/pci-ide@f,1/ide@0/cmdk@1,0:a
  4.6G 3.9G 741M 85%  /
/devices 0K 0K 0K 0%  /devices
ctfs  0K 0K 0K 0%  /system/contract
proc  0K 0K 0K 0%  /proc
mnttab  0K 0K 0K 0%  /etc/mnttab
swap  760M 772K 759M 1%  /etc/svc/volatile
objfs  0K 0K 0K 0%  /system/object
sharefs  0K 0K 0K 0%  /etc/dfs/sharetab

So my mission now is to find out how to get to able to write to the disk so I can restore /usr from /export/usr.

That's a relief I was quite worried that I aided and abetted you in breaking your system!

There is a remount option of the mount command which will mount it read-write, but I don't know if that works for /.

My Solaris is freshly installed, so I will try (once I get past all the "welcome", "did you know" and "configuring...." stuff that it throws up the first time you do anything on it.

That sounds cool :slight_smile:

I have been looking around in search for a "remount" but was unable to find one (attempted a find / -name remount too). Instead, I found mountall in /sbin/.

When I executed mountall, it mounted /tmp and /export/home. When I do a df -h, I now, besides my previous output have got these two:

swap  995M 0K 695M 0% /tmp
/dev/dsk/c0d1s7 224G 1.4G 221G 1% /export/home

This means that I can now write to /export/home/* but not to anything else. Unfortunately, this also means that I was unable to move /export/usr (and if I could, I would still not be able to create /usr and move the content to it) :rolleyes:

Can you try..

/sbin/mount -o remount,rw /

Strangely enough, my system does not recognize mount.

-bash-3.00# mount -o remount,rw /
-bash: mount: command not found
-bash-3.00# mount
-bash: mount: command not found

...Even though it is present in /sbin/ (I am in this dir when trying to execute):

-bash-3.00# ls -l | grep mount
-r-xr-xr-x 1 root bin 22992 Jan 23 2005 mount
-r-xr-xr-x 1 root sys 8159 Jan 22 2005 mountall
-r-xr-xr-x 1 root bin 18500 Oct 3 2008 umount
-r-xr-xr-x 1 root sys 7859 Jul 4 2007 umountall

I can only execute mountall and umountall - they share the fact that they are owned by root and belonging to the sys group. However, mount and umount are owned by root and belonging to the bin group. Does this mean anything or is it just "hot air"?

I just broke my Solaris again and tried the mount thing.

cd /
$ echo x > x
x: cannot create
$ /sbin/mount -o remount,rw /
echo x > x
(it worked)

(you need to either give the full path or cd /sbin and use ./mount)

Actually I just thought the same thing, I fixed it with /etc/mount instead, but the result should be the same :rolleyes: I hit a few others bumps on the road.

I have mounted / with write and deleted the pesky usr-link, created /usr and moved /export/usr/* -> /usr.

It is still a bit wobbly, though. After a reboot, it says that it cannot find /usr/sbin/fsck.

Full message (muuuch shorter than before the "fix"):

WARNING - /usr/sbin/fsck not found. Most likely the mount of /usr failed or the /usr filesystem is badly damaged.

Jun 28 18:23:29 svc.startd[7]: svc:/system/filesystem/usr:default: Method "/libsvc/method/fs-usr" failed with exit status 95.
Jun 28 18:23:29 svc.startd[7]: system/filesystem/usr:default failed fatally: transitioned to maintenance (see 'svcs -xv' for details)
Requesting System Maintenance Mode
(See /lib/svc/share/README for more information.)
Console login service(s) cannot run

Now, when I log in, it's clear that there is no such thing as /usr/sbin. I suppose this is less-than-good :wink:

However, there are:

-bash-3.00# find / -name sbin
/usr/xpg6/platform/i86pc/sbin
/usr/xpg6/sbin
/usr/xpg6/sfw/sbin
/sbin

Speculation: Could I boot into failsafe and create a /usr/sbin and copy /usr/xpg6/sbin to /usr/sbin? I tried from System Maintenance to create /usr/sbin and then a cp /sbin/* /usr/sbin which failed with:

cp: bpgetfile and /usr/sbin//bpgetfile are identical
cp: cannot access in.mpathd

Addition:
I found that bpgetfile is a link to /usr/sbin/pgetfile and in.mpathd is another link to /usr/lib/iet/in.mpathd. These *could* be discarded at first and investigated later?

Hmm. Why is /usr/sbin missing? It should be there (obviously! I was there before you moved stuff to /export/usr)

Can you send the output of:

ls -l /
ls -l /export/usr
ls -l /usr

(I'm in the process of fixing mine again, and it looks good.. no errors. This is after breaking it like yours the first time).

I got a little further. Now, it complains that it cannot mount /dev/fd. I copied all files from /sbin -> /usr/sbin with the exception of the two links which were fairly broken.

Here's some ls-mayhem (I have not written owner, group and mods since i'm doing it manually this time):

-bash-3.00# ls -l /
Desktop
Documents
bin -> ./usr/bin
boot
core
dev
devices
etc
export
home
kernel
lib
lost+found
mnt
net
opt
platform
proc
rmdisk
sbin
system
tmp
u03
usr
var
vol

-bash-3.00# ls -l /export/usr
total 0

-bash-3.00# ls -l /usr
bin
sbin (I created the directory and copied /sbin/* -> /usr/sbin)
xpg6

Well, it seems that /usr is missing a lot for stuff.

I'm sure it must be somewhere! It might be that you've copied it somewhere and then overmounted it when you rebooted.

Can you send the output of

mount
df
find / -name sbin -type f

Yeah, it could look like it's still missing something here and there.
Here is the result of our little detective work:

mount:
/ on /dev/dsk/c0d1s0 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=1980000 on Sun Jun 28 18:45:26 2009
/devices on /devices read/write/setuid/devices/dev=4700000 on Sun Jun 28 18:45:26 2009
/system/contract on ctfs read/write/setuid/devices/dev=4740001 on Sun Jun 28 18:45:12 2009
/proc on proc read/write/setuid/devices/dev=4780000 on Sun Jun 28 18:45:12 2009
/etc/mnttab on mnttab read/write/setuid/devices/dev=47c0001 on Sun Jun 28 18:45:12 2009
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4800001 on Sun Jun 28 18:45:12 2009
/system/object on objfs read/write/setuid/devices/dev=4840001 on Sun Jun 28 18:45:12 2009
/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4880001 on Sun Jun 28 18:45:12 2009

df:
/ (dev/dsk/c0d1s0): 1568400 blocks 419959 files
/devices (/devices): 0 blocks 0 files
/system/contract (ctfs): 0 blocks 2147493641 files
/proc (proc): 0 blocks 8082 files
/etc/mnttab (mnttab): 0 blocks 0 files
/etc/svc/volatile (swap): 1558680 blocks 150685 files
/system/object (objfs): 0 blocks 2147483509 files
/etc/dfs/sharetab (sharefs) 0 blocks 2147483646 files

find / -name sbin -type f
(no results)

my brain said "-type -d" and my fingers said "-type -f"

This is one for the scrap book! Six hours ago, I was happily bored :wink: I owe you some bits.

Can I ask you to run "find / -name sbin -type d" - can you first run mountall again, as /export/home is missing.

I'm struggling to know where everything from /usr went.