Add HDD to server

Discussion in 'Installation/Configuration' started by Poliman, Mar 14, 2017.

  1. Poliman

    Poliman Member

    Hi. I have ISP with one website + database (which is growing). This is VPS with Ubuntu 14.04 LTS with 10GB SSD. Currently there is 2,8GB free. I would like to buy one more disk drive (ovh.net provide an option "additional disk") but I am not sure what will be with next amount of data when whole space on first disk (this 10GB SSD) will be used. Do the data will automatically be saved on the second disk? What to do if they will not? How to make visible secondary disk in ubuntu?
     
    Last edited: Mar 14, 2017
  2. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    Are you using LVM partitions? If yes you just need to extend the partition to the second disk. Howtoforge has a tutorial how to use LVM.
    If not add the disk partition it and then mount it to a mnt/ folder, than move the content of the /var/www/ folder on it. After that just mount the disk to /var/www/ and put a record of the disk into fstab to mount the disk at boot.

    I don't fully understand your question. Do you have a real server or just a PC/workstation as server. On some servers you need to create a smart array and put the disk into before it's shovn in ubuntu. On some you need to enable the sata port on which you have the disk connected.
    And I bought a new disk and it was damaged and that 's why it didn't recognize the disk. So test the disk on a different machine.
     
  3. Poliman

    Poliman Member

    How to check this?
    Do you mean this one -> https://www.howtoforge.com/linux_lvm ?
    Hmm, could you say how to do it or some example commands? Second thing that I probably will have to move database on additional disk. /var/www directory takes something around 3GB and won't growth but mysql database for website is growing.
    I have VPS hosted by ovh.net. It's basic VPS server with 10GB SSD drive. OVH has option additional disk if space on default disk is not enough.
     
  4. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    Contact your hosting provider with this question. Don't know how VPS works have own servers. But if you're paying for the hosting call their support.

    Yeah I meant that tutorial... but again don't know how VPS works.

    Mysql and website are in different dirs. You need to google where your DB is saving files for ubuntu. Maybe you have the dir in ISPC under server?!

    Read a little about the basic how linux partitions and disks work.

    The command to show partitions and disks is fdisk -l
     
  5. Poliman

    Poliman Member

    I sent them question about LVM. I am waiting for answer from them.
    Yes, I know they are in different directories. Maybe I said inaccurately - /var/www with website files takes around 3GB. Databases (default mysql, dbispconfig, roundcube, website db) are in /var/lib/mysql directory.
    fdisk -l output:
    Code:
    Disk /dev/vda: 10.7 GB, 10737418240 bytes
    4 heads, 32 sectors/track, 163840 cylinders, total 20971520 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0005bac1
    
      Device Boot  Start  End  Blocks  Id  System
    /dev/vda1  *  2048  20971519  10484736  83  Linux
     
  6. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

  7. Poliman

    Poliman Member

    Yes, I did it. They said that they are not responsible with configuration only client...
    Btw for VPS they offer KVM and for public cloud is openstack.
     
    Last edited: Mar 17, 2017
  8. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    when you'll buy the new disk it will be displayed as /dev/vdb (the 1st disk is /dev/vda) in output fdisk -l.
    after that you need to partition the disk. A partition is disk plus number (/dev/vda1).
    Creat a partition with a filesystem ext4. You crate it with fdisk command... google for a guide... it's simple.
    When you have your partition /dev/vdb1, create a dir in /mnt(mkdir /mnt/disk). Now you need to mount your new partition to that dir.
    mount /dev/vdb1 /mnt/disk
    Move all the files from /var/www/ to /mnt/disk so your /var/www folder will be empty. Unmount disk from /mnt/disk (umount /mnt/disk).
    then mount your new disk (partition) to /var/www wtih mount /dev/vdb1 /var/www.
    After that you need to put an entry in /etc/fstab so that the partition is auto mounted at boot. Google how to permanent mount a partition. I don't know it exactly.

    After this your new disk will be used for the websites and the old for everything else. I figured that your website folder is /var/www if not just use your path in the commands. If you bought a really big disk you can create more than 1 partition (max 4) and do same for mail and mysql.
     
  9. Poliman

    Poliman Member

    Thanks for answer. I will check it. ;) I need move only mysql to second disk. /mnt/disk is the name which should be or it could be any name ex. /mnt/whatever ?
     
  10. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    You can name it anything you want. If you need more space for mysql just do as I said. Create more than 1 partition on the second disk and mount every partition where you need it. But don't forget that you'll get free space when moving websites to new disk/partition. So you will get free space that mysql can use!
     
  11. Poliman

    Poliman Member

    Yea, but in that case I have whole VPS for one website, which has one mysql database. Website is not taking much space but mysql will grow all time. :)

    PS
    One more thing. What if I would like to move database and /var/www to additional disk - should I each time mount and unmount disk/partition?
     
    Last edited: Mar 23, 2017 at 7:29 AM
  12. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    Mate I've got 20-30 sites on the server and my mysql_dump file for backuping up all databases is 500MB! So buy the disk when you need it.
    A partition can be mounted into any directory you mount them only twice. 1st time to a temp dir so you can move the files from the the folder you want to the partition mounted. You umount it from the temp dir. 2nd time you mount it to the dir you want to have the new partition (websites /var/www). Then you need to edit the /etc/fstab. (don't know the kode by heart so google it) Fstab then mounts the partition automaticly ob server boot. In it you'll see the entrys for your allready created partitions from /dev/vda. Sorry can't help you more. A good advice backup all data over ftp or scp to your PC before you do anything.
     

Share This Page