# Moving Plex Library

### Moving Plex Library to a Different Drive

If you need to move your Plex library to a different drive to free up space, follow these steps. This guide will ensure a smooth transfer without losing your data.

#### 1. Stop the Plex Service
To prevent changes to the database while moving the files, stop the Plex Media Server service:

```bash
sudo systemctl stop plexmediaserver
```

#### 2. Create the New Library Location
Make sure your new drive is mounted, and create a directory for the Plex library:

```bash
sudo mkdir -p /new/mount/plex_library
```

Replace `/new/mount/plex_library` with the path to the new location on your drive.

#### 3. Copy the Plex Library
Use `rsync` to copy the library files to the new location:

```bash
sudo rsync -av --progress /var/lib/plexmediaserver/Library /new/mount/plex_library/
```

- `-a`: Archive mode to preserve permissions and attributes.
- `-v`: Verbose mode to show file names being copied.
- `--progress`: Shows progress during the copy.

#### 4. Backup the Old Library (Optional)
Keep a backup of the original library just in case:

```bash
sudo mv /var/lib/plexmediaserver/Library /var/lib/plexmediaserver/Library_backup
```

#### 5. Create a Symlink to the New Location
Create a symbolic link from the original library path to the new one:

```bash
sudo ln -s /new/mount/plex_library/Library /var/lib/plexmediaserver/Library
```

This allows Plex to continue accessing the library as if it were in the original location.

#### 6. Adjust Permissions
Make sure the new directory has the correct permissions for Plex to access it:

```bash
sudo chown -R plex:plex /new/mount/plex_library/Library
```

#### 7. Start the Plex Service
Restart the Plex Media Server to verify the move:

```bash
sudo systemctl start plexmediaserver
```

#### 8. Verify the Move
Open Plex in your browser and verify that your media library is intact. If everything works properly, you can delete the old backup to free up space:

```bash
sudo rm -rf /var/lib/plexmediaserver/Library_backup
```

### Summary
- Stop Plex.
- Copy the library to the new drive.
- Create a symlink to the new location.
- Restart Plex and verify.

Using these steps ensures a safe move while keeping Plex operational without reconfiguration. If you encounter issues, feel free to ask for help!