I have installed a physical drive to my system where I'm going to save files for my application. I have mounted it at /storage/appfiles. Lets say in future the disk gets filled up to 100%, I will install another physical disk but how can I extend the directory /storage/appfiles so that I wouldn't need to modify my program's code and it will continue to work without knowing there is even another drive - is this possible?

  • If you initially set up your disk using LVM, then transparently adding a new physical disk to a volume group: vgextend ${VOLGROUP} ${PHYSICAL_DEVICE} – user4556274 Dec 26 '16 at 10:26
  • @user4556274 I'm not sure if I did that. I just connected the disk to the machine and used the command line to format and mount it. – php_nub_qq Dec 26 '16 at 10:38
  • Since this is tagged ubuntu, there's a good likelihood your machine was set up with lvm if you accepted defaults during install. Issue sudo lvm lvs to list your lvm volumes. If you get a listing, you have it. If you get an error that lvm is not installed, you don't... – user4556274 Dec 26 '16 at 10:45
  • @user4556274 okay it appears I have lvm volumes but there are only my initial drive and the swap partition listed, the drive in question I just installed is missing - should this be the case? – php_nub_qq Dec 26 '16 at 11:00
  • Sorry I'm not putting up a full answer, the linked howto covers all. You need to make lvm aware of the new disk with lvm pvcreate ${PHYSICAL_DEVICE} before adding it to your volume group. There are many options to all the lvm commands; best to read the manual to ensure you get the setup you want. – user4556274 Dec 26 '16 at 11:14

Your Answer

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

Browse other questions tagged or ask your own question.