My wife wants to use Nextcloud as cloud storage.
The occupancy of OneDrive is about to exceed 100GB!
I want to escape from paying monthly fee!
You should help me with your strawberry pi!
My toy is Raspberry Pi, not strawberry pi.
I moved her OneDrive data 100GB to Nextcloud which is hosted by Raspberry Pi 4 in my home.
This article is note of work.
I faced some troubles so to memorize how to resolve is good for someone who wants to do.
Steps to be done
Backing up data in OneDrive
I simply downloaded all data…
It took a few days…
If I knew REST API it were shorter…
Copying data to Nextcloud
There are some steps.
1. Copying files to Nextcloud user directory 2. Making Nextcloud recognize these files 3. Creating thumbnails of image/video files if needed
Copying files to Nextcloud user director
Any method is okey, I performed by SFTP because I already activated SSH and don’t want to install samba or other service.
If you extract zip files of OneDrive data in Linux host it may fails to extract multibyte files/directories.
Countermeasure is to use unar command.
To extract big file (>4GB) by unar command will output error.
Archive parsing failed! (Data is corrupted.)
I divided to some files before extracting.
Making Nextcloud recognize these files
This can be done by occ command.
– Official reference
Here you can see what I did.
sudo -u www-data php occ files:scan --path='/UserName/files'
I faced error.
An unhandled exception has been thrown: OC\HintException: : Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)
Exactly apcu is deactivated.
php -i | grep -i apcu Additional .ini files parsed => /usr/local/etc/php/conf.d/apcu.ini, apcu APCu Support => Disabled APCu Debugging => Disabled
Activated by doing this.
echo "apc.enable_cli=1" > /usr/local/etc/php/conf.d/apcu.ini echo "apc.enable=1" > /usr/local/etc/php/conf.d/apcu.ini
time sudo -u www-data php occ files:scan --path='/UserName/files' The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php The current PHP memory limit is below the recommended value of 512MB. Starting scan for user 1 out of 1 (UserName) +---------+-------+--------------+ | Folders | Files | Elapsed time | +---------+-------+--------------+ | 62 | 14356 | 00:02:22 | +---------+-------+--------------+ real 2m23.709s user 0m26.062s sys 0m3.560s
Creating thumbnails of image/video files if needed
Thumbnail is dynamically created when you access to your Nextcloud folder which contains image/video files.
As you can imagine this will occupy CPU resources which is unignorable for IoT device like Raspberry Pi…
To avoid such high CPU load, Preview-Generator will help you.
You just need to install by administrator account in Nextcloud and do this command.
sudo -u www-data php occ preview:generate-all UserName
In my environment RAM is needed more,
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /var/www/html/lib/private/legacy/OC_Image.php on line 576
I increased available memory size and performed occ command again.
vim.tiny /usr/local/etc/php/php.ini -memory_limit = 128M +memory_limit = 512M
Duration time depends on how many and how big image/video files are.
I executed before going to bed and confirmed next morning.
– About 5 hours to complete in my case.
Image thumbnail is not generated
Perhaps jpeg/heic thumbnail is not created.
This article will help you if you are in the same trouble.
Video thumbnail is not generated
Perhaps video thumbnail in multibyte path directory is not generated.
This article shows you how to resolve.
How was it?
It needs duration time, but doesn’t need your work!
let’s do it, why not?