Can I move my media files to a different partition on the server?
Question:
I have installed Centova Cast on a small partition on my server, and I want to place my media files on a different, large partition on the server. How can I do this?
Answer:
There are two ways to do this -- on a per-stream basis (meaning that you specify a different path for each stream), or on a server-wide basis (meaning that all of your streams' data is moved to another partition).
Per-Stream
Centova Cast resolves symbolic links in your media directories, so you can
simply place a symbolic link in the stream's var/spool/media/
directory which
points a different directory. So for example, you might do this:
- Put all of your shared MP3 files in the directory:
/var/lib/mp3/
- Create a symlink by running:
ln -s /var/lib/mp3 /home/centovacast/vhosts/USERNAME/var/spool/media/shared
This needs to be done on a per-stream basis. See below for moving all of your streams' media files to another partition.
Server-Wide
Warning: Please note that this is not officially supported nor recommended. Ideally you should install Centova Cast on the partition on which you wish to store your media files; if you have already installed Centova Cast but not created any streams, we strongly recommend simply reinstalling Centova Cast in the correct location. That said, if you have no other choice, the procedure below is your best option.
The Linux mount
command supports a special option named --bind
which
allows you to "graft" any directory on your system into a new location. So
for example, say you want to move your Centova Cast virtual host directory
(/home/centovacast/vhosts/
) onto your /var
partition which has more disk
space:
Temporarily disable your Centova Cast cron job in
/etc/crontab
by adding a hash symbol (#
) to the beginning of any lines containing the wordcentovacast
. For example, look for:*/2 * * * * centovacast /home/centovacast/system/...
...and replace it with:
# */2 * * * * centovacast /home/centovacast/system/...
Stop all of your streams in Centova Cast, and make sure your users cannot start them again for the next few minutes. (Stopping your web server is a good way to do this.)
Copy the
/home/centovacast/vhosts/
directory to its new home (for example,/var/centovacast/vhosts/
), but be sure to maintain ownerships and permissions as follows:mkdir -p /var/centovacast/vhosts/ cp -a /home/centovacast/vhosts /var/centovacast
Verify that the copy was successful by checking that
/var/centovacast/vhosts/
contains the exact same files and directory trees as/home/centovacast/vhosts/
. This step is critically important -- if the copy was unsuccessful, you'll permanently lose all of your clients' streams and media in the next step.Remove the contents of the original
/home/centovacast/vhosts/
directory.rm -rf /home/centovacast/vhosts/*
If you're not 100% sure of what you're doing, you may want to simply move the contents of the
vhosts/
directory to a new location instead, in case something goes wrong.Finally, use the mount command with the
--bind
option to graft the new directory into place:mount --bind /var/centovacast/vhosts /home/centovacast/vhosts
Because the mount command above is not persistent, it needs to be executed again every time your system boots up. The procedure for doing this varies depending on your Linux distribution, but typically adding the mount command to
/etc/rc.local
(or/etc/rc.d/rc.local
) will accomplish it.If you are an experienced systems administrator, you can alternately add a line such as the following to /etc/fstab instead:
/home/centovacast/vhosts /var/centovacast/vhosts none bind
This will ensure that the /home/centovacast/vhosts/ directory is mounted automatically at boot time.
At this point, the contents of /home/centovacast/vhosts/
should appear
identical to the contents of the /var/centovacast/vhosts/
directory. You
should be able to re-instate your cron job by reverting the changes you made
in step 1, re-start all of your streams, and allow your clients to access
Centova Cast again.
It is important to realize that, as a result of the mount command above,
/home/centovacast/vhosts
is now a shortcut to /var/centovacast/vhosts
. If you
delete a file from /home/centovacast/vhosts, it will also be deleted from
/var/centovacast/vhosts
, and so-on. Don't make the mistake of accidentally
deleting the contents of /home/centovacast/vhosts
, thinking it's no longer
needed!
NOTE: This article is for Centova Cast v2 only; an alternate version exists for Centova Cast v3.