I have this problem with my VPS running ubuntu.

/dev/nbd0 46G 46G 0 100% / 
/dev/nbd1 46G 52M 44G 1% /mnt/data

Now, since nbd0 is already full, how do i start using nbd1. All my website files are under /var/www/mydomain1 .

Do i need to create a similar folder under /mnt/data like below; /mnt/data/var/www/mydomain1?

I'm not sure how to achieve this because using SFTP to upload website files and i'm uploading all my files inside /var/www/mydomain1. Now, my issue is all the wordpress files are inside /var/www/mydomain1 and wordpress files are inside nbd0 volume. If i start uploading files inside /mnt/data, how am i suppose to make this work. Im using Wordpress. I have googled, but couldn't find any resources to this.

Thanks in advance guys. A little guidance or resources to solve this issue will be really helpful for me.

  • Why do you mount it at /mnt/data? You could instead mount it where you need it. – Michael Hampton Feb 26 '17 at 0:05
  • Ok, so you meant to say instead of mounting like this: mount /dev/nbd1 /mnt/data , i can mount /dev/nbd1 / and i can continue adding files in the same place where i used to upload. I'll try. – Allroundstart Feb 26 '17 at 0:16
  • Huh? That's not how mounting devices works. You already have something mounted at /. – Michael Hampton Feb 26 '17 at 0:17
  • yes, nbd0 is already mounted at / . Actually my website files are inside /var/www/mydomain1 . But /dev/nbd0 is already full. Now i have /dev/nbd1 which has 50GB of free storage to use. Is it possible for me to keep uploading files at the same location /var/www/mydomain1 but use the space from /dev/nbd1 – Allroundstart Feb 26 '17 at 0:31
  • The problem is that you have to somehow make those new files accessible to the web server under its document root. It would have been better to expand the original device rather than to add a second one. – Michael Hampton Feb 26 '17 at 0:33

You need to migrate your /var/www/ directory onto the new drive. There are a couple of ways to do this. The easiest at this point is probably to create a symbolic link to the new location. (The alternative is to remount the new partition into the correct location).

  1. Free up a little space on / (clear some logfiles, etc)
  2. Stop the existing webserver and upload processes
  3. Copy all the web contents to the new drive rsync -ai /var/www /mnt/data/www. After this you should have /mnt/data/www containing the same thing as /var/www.
  4. Move the existing www directory out of the way mv /var/www /var/www.old
  5. Symlink the new location into place ln -s /mnt/data/www /var/www
  6. Restart the webserver and upload processes.

If there is a problem, your rollback is

  1. Stop the existing webserver and upload processes
  2. rm /var/www (the symlink)
  3. mv /var/www.old /var/www
  4. Restart the webserver and upload processes

After a suitable time to validate it is working properly, remove /var/www.old.

  • Thank you, just a quick question before i begin now. Will this rsync -ai /var/www /mnt/data/www copy everything because the size of /dev/nbd0 is 50GB and the new /dev/nbd1 is also 50GB. What will be the process if i have more than two volumes. /dev/nbd0 /dev/nbd1 /dev/nbd3 /dev/nbd4 – Allroundstart Feb 26 '17 at 3:37
  • I am assuming that /var/www is not the entirety of whats taking up space on /. If it is it gets more complicated. You could pick a subdirectory of /var/www and do the same thing. – Jason Martin Feb 26 '17 at 3:53
  • Also, if your provider offers a backup, its a good idea to take one before doing anything. – Jason Martin Feb 26 '17 at 3:54
  • Ok. I'm beginning to understand. Thank you. What do i need to do again if my /dev/nbd1 gets full, i meant i still have /dev/nbd2 and /dev/nbd3 . So, do i need to follow the steps given above from /dev/nbd1 to /dev/nbd2 and then from /dev/nbd2 to /dev/nbd3 ? Please correct me if i'm wrong. – Allroundstart Feb 26 '17 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.