I will have to add another virtual disc first, otherwise where can i move the data to. Right?
Can i use the same name ânc-dataâ ?
I will try to find out how to move the data first.
Two drives, one is for nextcloud files (config) and the other one is for user data. This is how the creator of the esx image file which i used made it. As far as i know.
I have cloned my nextcloud installation, changed hostname and IP. Deleted the biggest users, so less data to move during testing.
I have added a new (4th) 600GB (virtual) hard disc.
I am going to try to figure out how to exactly move the data. After moving the data, shouldnât i also change references in config files which will point to the wrong location of the data (after moving).
Only if you have a new location, you can also stop the server, move data to the new drive and mount it under old location. In this case no configuration change needed.
Thanks again for all the help.
With regards to the bug, i already have a sort of similair problem. Like i told you, i cloned the nextcloud setup and removed all the users with much data. Ieft a couple accounts in total about 55GB. But when i look at the Nextxloud GUI it tells me 500GB is used.
I assumed that the nextcloud config wouldnât take about 450+ GB. So do you have any idea why my Nextcloud is so big?
With regards to the moving, yes i would like to mount the new drive onder the old location. That was how i thought about it in my head
But what do you mean by âstop the server offâ?
Sorry i am really a linux n00b. I have a new disc (sdd). But before i can move i will have to create a partition âsdd1â and format the partition as lvm right? I have tried this:
mkpart primary 0 214GB
When i did this i got âthe resulting partition is not properly aligned for best performance ignore/cancelâ so is this correct?
quit
Is what i did correct?
And i am not sure what to do next and how to do it. I have created a partition now right? But how do i format it as lvm? See picture for my new disc + partition.
@gas85, are you on holiday or maybe not receiving the email updates? Of course i am not in a big hurry and i am very greatful for you help so far and certainly not wanna rush you
Somebody else maybe a suggestion? @eehmke maybe? You helped me out before in a great way!
Sorry, have a lot to do at work and wedding anniversary also taking a lot of time
First of all you need to decide what you want to achieve: are U going to expand size of your hdds? Or you want to have something like RAID 1 where data is mirrored in case one of hdds is getting broken.
Why U need sdd? To move data folder from it? If yes, then it looks a bit too small, according to your screenshot from above you have around 1.4 Tb of data, it will not fit into 200 GB sdd.
Could you please check how you are using drives now?
df -h
Then check how big is your data directory. Please replace /var/www/nextcloud with your path to the Nextcloud:
du -sh $(grep datadirectory /var/www/nextcloud/config/config.php | cut -d "'" -f4)
Basically LVM looks like this
How LVM works in a simple 3 steps:
you initialize any drive or partition to LVM by pvcreate. You even do not need to create any partition, simply added whole drive.
you will create new virtual group on selected partition vgcreate
you will create new logical volume on selected virtual Group lvcreate
you will create FS on a logical volume that you set with e.g. mkfs.ext4 or zfs if you need.
Now you can move data to the new volume and added new drives to expand space. This is short story⌠Long for example here but it is in Russian or here is in English.
first of all happy anniversary! I have removed a lot of user data from my test Nextcloud so it was easier to try/test.
I simply want to add a new (virtual) hard disc (which i think i did, the âsddâ). So i would like to move the data FROM the zfs pool to SDD. After that delete the zfs pool, and mount the data on SDD exactly the same as it was (i think that is /mnt/ncdata). According to df -h, the sdd drive should be big enough right? SDD is 200GB and Ncdata is 60GB right?
so now i just type in âpvcreateâ? I do not have to change my console to âsddâ first? (Like in windows from C to D partition)?
There are a lot of LVMs howto in internet. Just to not live you without anything above I post already example of reference.
You can ether reuse your existing Volume Group: nextcloud-vg (in this case skip step 2 and replace vg-next-data with nextcloud-vg), or added new one. This example will added new one.
Please MAKE A BACKUP OF DB AND DATA and other relevant folders BEFORE TO START:
You need to create a LVM physical volume on the partition
pvcreate /dev/sdd1
Then you need to create volume Group (e.g. name âvg-next-dataâ)
vgcreate vg-next-data /dev/sdd1
create the logical volume that LVM will use (e.g. name âlv-next-dataâ):
lvcreate -L 200G -n lv-next-data vg-next-data
The -L command designates the size of the logical volume, in this case 200 GB, and the -n command names the volume. Vgpool is referenced so that the lvcreate command knows what volume to get the space from.
Format and Mount the Logical Volume
mkfs.ext4 /dev/vg-next-data/lv-next-data
mkdir /mnt/ncdata_new
mount /dev/vg-next-data/lv-next-data /mnt/ncdata_new
Stop your nextcloud/webserver, stop your DB
Move data from /mnt/ncdata to /mnt/ncdata_new
Dismount /mnt/ncdata and /mnt/ncdata_new
Mount your LVM to the old location
mount /dev/vg-next-data/lv-next-data /mnt/ncdata
Ensure, that zfs is not mounted anymore:
lsblk
Start your server and check if everything ok and working.
Play with your ZFS.
P.S. after you finished you can added your sdb to the LVM as physical disk:
mkfs.ext4 /dev/vg-next-data/lv-next-data
mkdir /mnt/ncdata_new
mount /dev/vg-next-data/lv-next-data /mnt/ncdata_new
sudo systemctl stop apache2
sudo systemctl stop postgresql
sudo rsync -avP /mnt/ncdata /mnt/ncdata_new/
umount /mnt/ncdata
umount /mnt/ncdata_new
mount /dev/vg-next-data/lv-next-data /mnt/ncdata
This is what lsblk shows now:
so i think i did it I do not have to do some sort of SAVE ALL right? Not that after a reboot the mounting point, points to the previous partition again
Is there a way to rename the "vgânextâdata-lvânext⌠? Just because it looks a bit ugly
Do i still have to do the âP.S.â part? I am not sure why i should add sdb to LVM as a physical disk. And why should i move the data back from sdd to sdb? Isnât the next thing to do just delete/remove sdb en sdc? And after that remove the virtual drives?
I am talking about this part:
P.S. after you finished you can added your sdb to the LVM as physical disk:
vgextend vg-next-data /dev/sdb1
and then simply move data from sdd to the sdb:
pvmove /dev/sdd1 /dev/sdb1
And remove sdd from the LVM:
vgreduce vg-next-data /dev/sdd1
No mounts, no issuesâŚ
To me it seems a bit like it is done after step 11, of course not saying you are wrong just curious
Again many thanks so far! after these final steps i am gonna clone my Nextcloud again and do this proces again in one evening. If that goes well, i will do this to my âproductionâ Nextcloud installation. (Of course not without a proper extra backup )
I have tried to skip the âP.S. partâ and reboot the VM, but then i am not able to login my user account an during the reboot i see all kind of ZFS errors. So apparently i still have to remove and links to the ZFS pool?
âP.S.â Part is only possibility to move data between the HDDs without even unmount it. E.g. when older disk dies and you can still move data to the new one.
Regarding ZFS, I belive you need to cleanup your /etc/fstab and live only needed parts, e.g. boot and with LVM.
But i donât know what do do here, as far as i know the nextcloudâvg-root and swap are necessary. And i am not seeing and ZFS references.
I have started my sql en apache and i got the error âmake sure .ocdata is present in main directoryâ.
So i compared with my production NC, and the user data is not in the /mnt/ncdata directory on my test nextcloud. The files are in the /mnt/ncdata/ncdata.
So somewhere down the line i made a mistake. So i need to move the files from /mnt/ncdata/ncdata to /mnt/ncdata. i moved the files with this command: