# Mounting an external drive using UUID and fstab | Linux admin junior

**URL:** <https://help.nextcloud.com/t/mounting-an-external-drive-using-uuid-and-fstab-linux-admin-junior/97757>\
**Category:** 📑 How to\
**Tags:** ncp\
**Created:** [November 10, 2020, 7:35pm UTC](https://help.nextcloud.com/t/mounting-an-external-drive-using-uuid-and-fstab-linux-admin-junior/97757 "2020-11-10T19:35:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OliverV](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oliverv/32/5741_2.png) [@OliverV](https://help.nextcloud.com/u/OliverV)\
**Post date:** [November 10, 2020, 7:35pm UTC](https://help.nextcloud.com/t/mounting-an-external-drive-using-uuid-and-fstab-linux-admin-junior/97757/1 "2020-11-10T19:35:06Z")

</div>

Create a mountpoint for the external drive for ncdata

> ###### **sudo mkdir /media/ncp**

Find UUID of external drive

> ###### **ls -lh /dev/disk/by-uuid/**
> 
> (Mine looks like this)  
> total 0  
> lrwxrwxrwx 1 root root 15 Aug 11 09:10 29075e46-f0d4-44e2-a9e7-55ac02d6e6cc → …/…/mmcblk0p2  
> lrwxrwxrwx 1 root root 10 Aug 11 09:10 **35e98a80-8895-41f4-93e7-39940a1fda70** → …/…/sda1  
> lrwxrwxrwx 1 root root 15 Aug 11 09:10 9304-D9FD → …/…/mmcblk0p1

To add a ligne to /etc/fstab

> ###### **sudo nano /etc/fstab**

add line for your drive (copy/paste your drive’s UUID):

> UUID= **YourDrive’sUUID** /media/ncp ext4 rw,users 0 0  
> or if using btrfs  
> UUID= **YourDrive’sUUID** /media/ncp btrfs rw,users 0 0

mount the drive

> ###### **sudo mount -a**

Verify drive is mounted:

> ##### df -h

Create folder for ncdata

> sudo mkdir /media/ncp/ncdata  
> sudo chown www-data:www-data /media/ncp/ncdata

Or when using btrfs

> sudo btrfs subvolume create /media/ncp/ncdata  
> sudo chown www-data:www-data /media/ncp/ncdata

You can use [nc-datadir](https://docs.nextcloudpi.com/en/configuration-reference/#nc-datadir) to move ncdata to the new location.

Or use rsync and manually edit config.php.

---

<div class="post-metadata">

**Author:** ![anon75456558](https://help.nextcloud.com/letter_avatar/anon75456558/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon75456558](https://help.nextcloud.com/u/anon75456558)\
**Post date:** [April 20, 2022, 4:01pm UTC](https://help.nextcloud.com/t/mounting-an-external-drive-using-uuid-and-fstab-linux-admin-junior/97757/2 "2022-04-20T16:01:37Z")

</div>

2 posts were split to a new topic: [Understanding Fstab mount options](https://help.nextcloud.com/t/understanding-fstab-mount-options/137831)
