Home How-To, Linux, Raspberry Pi Setup a Raspberry Pi Cloud Server With Nextcloud
How-ToLinuxRaspberry Pi

Setup a Raspberry Pi Cloud Server With Nextcloud

Setting up the USB Drive

Before your USB drive can be used, it needs to be mounted properly so that it appears to the system the same way each time the Raspberry Pi boots. This is important because we’re going to be telling Nextcloud specifically where to store the data. If the drive mount point moves each time there’s a reboot then we’ll quickly be in trouble.

Plug in the USB drive, then open a Terminal window and type:

sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL

This wil display all mounted drives on your system.

Here you can see that there are two disks connected to the system; the SD card that the Raspbery Pi boots from and a 320GB hard disk called sda, which has a partition called sda1.

Run the following command to confirm the location of the disk partition:

sudo blkid

In my case this showed the location to be “dev/sda1”, but yours may be different.

We’re going to create a folder to be the mount point for this disk. I’ll call mine “data”, but you can call yours whatever you’d like:

sudo mkdir /mnt/data

Next we need to mount the physical storage drive to the mount point above:

sudo mount /dev/sda1 /mnt/data

You can then verify this by running this command:

ls /mnt/data

Next we want to setup the system so that the above will happen automatically at reboot. This requires editing a configuration file, but first we need to find the universally unique identifier of the hard disk.

To do this run this command:

sudo blkid

Find the hard disk in the list and then make a note of the UUID shown.

Mine is “504d3da4-3dd1-4171-b1c3-45b36f23143c” – yours may be longer or shorter.

Next open the configuration file:

sudo nano /etc/fstab

Add the following line to the end of the file, replacing my UUID with your own:

UUID=504d3da4-3dd1-4171-b1c3-45b36f23143c /mnt/data ext4 defaults,auto,users,rw,nofail 0 0

Press ctrl+O to save the file, then ctrl+X to exit.

Your mount points should remain now even after a reboot.

Author

Matt

Leave a Reply