I have a local web server running locally in the office.

It has two hard drives:

  1. 120 GB SSD - on which / is mounted, So the web server /var/html is on the SSD
  2. 1TB HDD - mounted in /media on which daily backups of all the websites are stored.

Both the drives are eventually going to get exhausted. I cannot just swap the current Hard drive and add a new one there, I need to increase the partition sizes so that new sites backups keep running smoothly.

While searching for solutions, I came across LVM, But all the tutorials that I found are creating logical partitions from scratch (unused physical partitions) Which is not actually a solution for my case, Is there any way to move to using LVM without losing any current data?

Operating system on server is Ubuntu 14.04 LTS.

The filesystem is ext4. The SSD has 47GB Free and HDD has 450GB free space.

  • What is the file system that you use? How much space is already used on the drives? Do you have the possibility to add an external drive to be used only during the conversion?
    – Marco
    Nov 5 '15 at 7:40
  • The filesystem is ext4 The SSD has 47GB Free and HDD has 450GB free space. I can add extra hard drives.
    – Nik
    Nov 5 '15 at 11:11
  • FIRST BACKUP ALL! You can not directly convert a partition to a lvm. In your case you must first maximize the partition and then expand the fs. Here there is an example askubuntu.com/questions/24027/…
    – LilloX
    Nov 5 '15 at 11:41

Mount the extra hard drive and prevent that something is changed on the 1TB HDD. Now copy over all files in /media. Unmount the 1TB HDD from /media and mount the exta hard drive on it. Now the /media can be used again if you need. Then you make your 1TB HDD an LVM managed disk. When finished you copy back the data from the extra hard disk to the LVM 1TB HDD and mount it again to /media. For the SSD it will be more tricky since it is used by the server itself.

  • Is it possible to mount /var on a New LVM? I am thinking od creating a new LVM from a new hard drive, and mounting it under /var and copy all the current /var to new LVM. as /var needs to grow over time. Will this be possible?
    – Nik
    Nov 7 '15 at 5:08
  • Should be no problem to put it on a separate logical volume.
    – Marco
    Nov 8 '15 at 18:40

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.