Changing apache's www to a new disk

Discussion in 'General' started by helders, Oct 9, 2019.

  1. helders

    helders New Member

    Hi guys!

    I have ISPConfig 3 lastest version installed on a Debian 9 server and its disk is starting to get full. So i added a new disk to it and mounted it as /sites. What i'd like to do now is change the default folder from /var/www to /sites but i'm not sure what is the best way to do it.

    I know i have change it on the Web tab of the Server Config, changing the following parameters:

    Website basedir - from /var/www to /sites
    Website path - from /var/www/clients/client[client_id]/web[website_id] to /sites/clients/client[client_id]/web[website_id]
    Website symlinks - from /var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/ to /sites/[website_domain]/:/sites/clients/client[client_id]/[website_domain]/

    Here is what i was thinking so far:
    Copy all files on /var/www to /sites (cp -r /var/www /sites) then fix files ownership (chowning them accordingly) and then change the configs on ISPconfig as mentioned. Restart apache and pray for the best hehe

    I saw another approach on this post but i'm not sure if it's recommended.

    What would be the best way to do it? Dunno if there is a tutorial about it already but i couldn't find one.
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    I wouldn't attempt to change any config myself.

    I would rsync /var/www/ to /sites/
    probably try that a couple of times to get the amount of data to resync (and time required) to a minimum.
    if /var/www is currently a normal folder on your servers system drive, I would also consider mounting another drive and copying it there as well, just in case anything goes wrong.
    once the syncing is done. stop apache (remember to stop any monitors that would restart it) resync /var/www/ to /sites/ again.
    once this final resync is complete, rm -rf /var/www/ to free up system drive space, or just unmount it if it's another drive.
    unmount /sites, and remount it at /var/www. restart apache.
    check everything works as expected.

    once you're satisfied everything works ok and is stable. you can remove the extra mounted backup disk if you made one.
    the rm-rf /var/www is to empty that folder and free up system drive space, if you remount /sites to /var/www and /var/www is on your system drive, then all the files that were there before will still be there, taking up disk space but completely inaccessible, and if you run out of space on / the only way to recover this wasted space would be to stop apache again, unmount /var/www, clear out /var/www, and then remount the drive to /var/www and restart apache.
     
  3. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  4. helders

    helders New Member

    @Taleman thank you so much, i guess that's exactly what i was looking for!
     

Share This Page