3

First question:

When I run df -h I can see this:

# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1a    9.7G    8.0G    918M    90%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad4s1d    1.8T    6.7G    1.6T     0%    /home
procfs         4.0K    4.0K      0B   100%    /proc
linprocfs      4.0K    4.0K      0B   100%    /usr/compat/linux/proc
devfs          1.0K    1.0K      0B   100%    /var/named/dev

Why doesnt it show directories like:

/var /etc /usr

? On my earlier dedicated server, I was able to view every partition size available, but here I got only /home and /...

Second question:

How I can increase the /var partition size? Because after 2 hours of working, this partition is became full...

Cyclone
  • 250
  • 1
  • 6
  • 20

4 Answers4

6

The df command reports disk space usage by file system. Your /var /etc and /usr are not a separate file systems they are part of the / file system. You only have 2 file systems / and /home.

If you can reinstall the system you could change the partitions to create a /var file system of a suitable size.

If you can't then you could try creating a link /var ->/home/var but the specifics of how to do this depend on the access you have tot he system.

user9517
  • 114,104
  • 20
  • 206
  • 289
3

Why doesnt it show directories like:

Because they don't have their own file system on this machine, but are subdirectories of /.

On my earlier dedicated server, I was able to view every partition size available, but here I got only /home and /...

Because you only have those, presumably.

How I can increase the /var partition size? Because after 2 hours of working, this partition is became full...

Youy can't, because you don't have a /var partition.

If you add another disk, you could move all the stuff under /var to this disk and mount it as /var.

Edit: I just saw that /home/ is nearly empty. So, move all your stuff under /var to /home/var and replace /var by a symlink there. It's possible that you may need to do this in single-user mode or from a rescue system.

Sven
  • 97,248
  • 13
  • 177
  • 225
  • Its a dedicated server. I need more size under the `/var` directory, basicly for the mysql. If I cant increase the partition size, I guess I'll have to change the default mysql directory from `/var/db` to the something like `/home/db` ? – Cyclone Mar 14 '12 at 22:38
  • Either my approach from the edit or yours will work, but I would move just the MysQL directory if I need to avoid downtime to the rest of the system since this can be done with just shutting down MySQL, move the data over and symlink or reconfigure the data dir. – Sven Mar 14 '12 at 22:41
  • @SvenW fBSD will keep humming along if you destroy the `/var` folder, can't speak for whatever daemons/programs he's go running, but the OS doesn't need to be in single-user mode or anything special. – Chris S Mar 16 '12 at 13:58
3

As mentioned above, you can't increase /var as far as it is not a seperate FS. But you can move it from / to larger FS like /home. The only suggestion - use dump/restore to move current content of /var to new location instead mv or tar voodoo. That saves not only ownerships and permissions but also so-called 'flags' like schg/uchg for /var/empty. Also, I want to prevent you from creating hardlink /home/var -> /var as far, as /home and / are on different partitions. Generally all can be done this way:

  # mkdir /home/var
  # cd /home/var
  # dump 0af - /var | restore rf -
  # chflags -R nouchg,noschg /var
  # rm -r /var
  # ls -s /home/var /var

Sure, all above needs single-user mode or, if it's unavailable, you first have to stop all daemons that uses /var - like sendmail or mysql.

The other good practice - move out not the whole /var but only dirs that tends to grow. Such are /var/db/mysql, /var/log and /var/mail. I prefer to create a seperate homes for them - /usr/home/log, /usr/home/mysql and /usr/home/mail and so on. Thus dirs are linked to their usual locations in /var to prevent software configuratons.

Kondybas
  • 6,864
  • 2
  • 19
  • 24
2

I would take a slightly different approach to what's been proposed so far, simply because I don't like symlinking inside /var. As before, create a new directory under /home to hold the data you want to move, and copy the data across.

You can use a nullfs mount point to mount the real directory (e.g., /home/var/db/mysql) to the location the software expects it:

mount -t nullfs /home/var/db/mysql /var/db/mysql

In /etc/fstab, you'd want this:

/home/var/db/mysql  /var/db/mysql  nullfs  rw   0    0

Note that for this approach to work, you need either options NULLFS in your kernel, or you need to have the nullfs kernel module available.

As far as the system is concerned, it can access the contents of /home/var/db/mysql through /var/db/mysql exactly as normal. This approach also means that utilities like stat(1) and realpath(1) will report paths as being under /var, and not under /home/var.

D_Bye
  • 401
  • 2
  • 5