<blockquote>
  <p>I get the following error:</p>

<pre><code>Error: Cannot obtain a lock on data directory /media/pi/FreeAgent GoFlex Drive
Bitcoin Core is probably already running. No such file or directory.
</code></pre>
  
  <p>I tried stopping the process with</p>

<pre><code>bitcoin-cli stop
</code></pre>
</blockquote>

<p>Bitcoin Core is already stopped when you get that error. It can't run without the datadir.</p>

<blockquote>
  <p>But that didn't seem to do anything.  Is the problem that the external
  hard disk has to be formatted and mounted, as per instructions
  [here][1]?</p>
  
  <p>As a test, I tried writing a file to the hard disk from the system and
  received the following error:</p>

<pre><code>mv: inter-device move failed: 'testfile' to '/media/pi/FreeAgent GoFlex Drive/testfile'; unable to remove target: Read-only file system
</code></pre>
  
  <p>This does seem to confirm this hypothesis that the disk needs to be
  formatted/mounted.</p>
</blockquote>

<p>No, it does not necessarily need to be formatted.</p>

<p>The problem is that your user does not have the correct permissions to write to your external drive. Make sure that your drive is writable and that your user has the permissions to write to the external drive. You may have to change how it is being mounted to the system (drives always have to be mounted in order to be accessible).</p>

CC BY-SA 3.0
2018-02-15T13:59:17.543Z
thanks.  It seems that it's a user permissions issue because I was able to view jpeg photos that I have on the external drive.  Please let me know if that makes sense and that I only need to address the write permissions issue, but not the mounting.
matsuo_basho
CC BY-SA 3.0
2018-02-15T16:48:34.040Z
You only need to fix file permissions. Mounting may still be related because file permissions could be related to how the drive is mounted. Note that it is already mounted because you are able to access it.
Ava Chow
CC BY-SA 3.0
2018-02-15T21:34:30.863Z
You wrote that Bitcoin core is already stopped when I get that error, and rather it can't run without datadir.  Do you mean that I have to manually specify datadir before running bitcoind?  When i ran bitcoin daemon it seemed to have started - I would imagine that the blockchain is written to a default directory if datadir is not specified.
matsuo_basho
CC BY-SA 3.0
2018-02-16T00:05:35.863Z
There is a default datadir. When you specify a datadir, it does not attempt to fallback to anything. If it can't write to the datadir it is using (either specified or the default if none was specified), it will simply exit with an error.
Ava Chow
CC BY-SA 3.0
2018-02-17T03:33:53.803Z
I tried to change permissions with following command `chmod 755 FreeAgent\ GoFlex\ Drive/`.  Got error: `chmod: changing permisssons of 'FreeAgent GoFlex Drive/':` Read-only file system.  Also tried running `sudo mount -o remount,rw '/media/FreeAgent\ GoFlex\ Drive/`.  Got error `mount: mount point /media/FreeAgent\ GoFlex\ Drive/` does not exist
matsuo_basho
CC BY-SA 3.0
2018-02-15T06:20:31.047Z
2018-02-15T06:20:31.047Z
Ava Chow
<p>I have a Raspberry Pi 3.  I'm running bitcoind for the first time and would like to save the blockchain to an external hard disk.</p>

<p>When I run 
<code>bitcoind -datadir=/media/pi/FreeAgent\ GoFlex\Drive</code></p>

<p>I get the following error:</p>

<pre><code>Error: Cannot obtain a lock on data directory /media/pi/FreeAgent GoFlex Drive
Bitcoin Core is probably already running. No such file or directory.
</code></pre>

<p>I tried stopping the process with</p>

<pre><code>bitcoin-cli stop
</code></pre>

<p>But that didn't seem to do anything.  Is the problem that the external hard disk has to be formatted and mounted, as per instructions <a href="http://raspnode.com/diyBitcoin.html" rel="nofollow noreferrer">here</a>?</p>

<p>As a test, I tried writing a file to the hard disk from the system and received the following error:</p>

<pre><code>mv: inter-device move failed: 'testfile' to '/media/pi/FreeAgent GoFlex Drive/testfile'; unable to remove target: Read-only file system
</code></pre>

<p>This does seem to confirm this hypothesis that the disk needs to be formatted/mounted.</p>

<bitcoin-core><linux><raspberry-pi>
Is it necessary to mount an external hard disk to save blockchain to external hard disk on Raspberry PI?
matsuo_basho
# Is it necessary to mount an external hard disk to save blockchain to external hard disk on Raspberry PI?

(Asked by: username_0 on 2018-02-15)

I have a Raspberry Pi 3. I'm running bitcoind for the first time and would like to save the blockchain to an external hard disk.

When I run
`bitcoind -datadir=/media/pi/FreeAgent\ GoFlex\Drive`

I get the following error:

```
Error: Cannot obtain a lock on data directory /media/pi/FreeAgent GoFlex Drive
Bitcoin Core is probably already running. No such file or directory.

```

I tried stopping the process with

```
bitcoin-cli stop

```

But that didn't seem to do anything. Is the problem that the external hard disk has to be formatted and mounted, as per instructions [here](http://raspnode.com/diyBitcoin.html)?

As a test, I tried writing a file to the hard disk from the system and received the following error:

```
mv: inter-device move failed: 'testfile' to '/media/pi/FreeAgent GoFlex Drive/testfile'; unable to remove target: Read-only file system

```

This does seem to confirm this hypothesis that the disk needs to be formatted/mounted.

**Tags:** bitcoin-core, linux, raspberry-pi


---

## 1 answers

### Answer by username_1 on 2018-02-15. Score: 1

> I get the following error:
>
> ```
> Error: Cannot obtain a lock on data directory /media/pi/FreeAgent GoFlex Drive
> Bitcoin Core is probably already running. No such file or directory.
>
> ```
>
> I tried stopping the process with
>
> ```
> bitcoin-cli stop
>
> ```

Bitcoin Core is already stopped when you get that error. It can't run without the datadir.

> But that didn't seem to do anything. Is the problem that the external
> hard disk has to be formatted and mounted, as per instructions
> [here][1]?
>
> As a test, I tried writing a file to the hard disk from the system and
> received the following error:
>
> ```
> mv: inter-device move failed: 'testfile' to '/media/pi/FreeAgent GoFlex Drive/testfile'; unable to remove target: Read-only file system
>
> ```
>
> This does seem to confirm this hypothesis that the disk needs to be
> formatted/mounted.

No, it does not necessarily need to be formatted.

The problem is that your user does not have the correct permissions to write to your external drive. Make sure that your drive is writable and that your user has the permissions to write to the external drive. You may have to change how it is being mounted to the system (drives always have to be mounted in order to be accessible).

> **Comments:**
> **username_0**: thanks.  It seems that it's a user permissions issue because I was able to view jpeg photos that I have on the external drive.  Please let me know if that makes sense and that I only need to address the write permissions issue, but not the mounting.  
> **username_1**: You only need to fix file permissions. Mounting may still be related because file permissions could be related to how the drive is mounted. Note that it is already mounted because you are able to access it.  
> **username_0**: You wrote that Bitcoin core is already stopped when I get that error, and rather it can't run without datadir.  Do you mean that I have to manually specify datadir before running bitcoind?  When i ran bitcoin daemon it seemed to have started - I would imagine that the blockchain is written to a default directory if datadir is not specified.  
> **username_1**: There is a default datadir. When you specify a datadir, it does not attempt to fallback to anything. If it can't write to the datadir it is using (either specified or the default if none was specified), it will simply exit with an error.  
> **username_0**: I tried to change permissions with following command `chmod 755 FreeAgent\ GoFlex\ Drive/`.  Got error: `chmod: changing permisssons of 'FreeAgent GoFlex Drive/':` Read-only file system.  Also tried running `sudo mount -o remount,rw '/media/FreeAgent\ GoFlex\ Drive/`.  Got error `mount: mount point /media/FreeAgent\ GoFlex\ Drive/` does not exist  

---

