Set up OSMC and PiDrive

Hi all.

I’ve been using Kodi / OSMC for a while now, and while I’m no power user, I think I know my way around it OK.

I used to have a couple of Raspberry PI’s (2 and 3’s) around the house on the various TV’s and I had a Raspberry Pi driven NAS server. All the PI’s / OSMC installs could access the NAS so any media that was stored on it was accessible to all the OSMC installs as well as anyone on the network. This worked quite well until I had a lightening strike a few weeks ago which fried just about everything on my network. Insurance agreed to shell out a pile of cash and while I was looking around on the net, I came accross the OSMC PiDrive setup. I was immediately so excited at the idea that I just pulled the trigger and bought one. It arrived and I was thrilled to bits.

I started to set it up and install OSMC on the SD card that came with the kit. I kind of just thought that the PiDrive would be “automativally” accessible. I set up my downloads path in one of the add-ons, and in haste, just used what I thought “must” be the media path. Turns out it was saving downloaded content to the SD card which I filled up pretty quick and I realised my error.

So my questions are these :-

  1. What is the best way to set up OSMC and a PiDrive? From what I have read on old threads, opinions vary, but nearly a year later, can anyone comment on what has worked best over a longer period.

  2. How do I do the above?

  3. Will other OSMC boxes be able to access Pi Drive?

Thanks

Well I think opinions vary on this topic. My suggestion is to format the drive and give it a proper Label. Then it will be automounted under /media/

While some people would say as it is a dedicated/fixed drive you could permanently mount it via fstab to a directory under /mnt/

Well you always have the chance to use upnp build in Kodi or for better features and performance suggest to install samba server from App Store.

fzinken

Thanks for the reply. I’ve now loaded Samba support from the App Store - it certainly does make it easy to navigate to the OSMC box from a windows machine.

Could you give me step by step instructions for the above?

I have SSH’d into the OSMC box and and run sudo fdisk -l I can see the PiDrive listed like this

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 499711 497664 243M c W95 FAT32 (LBA)
/dev/mmcblk0p2 501760 15644671 15142912 7.2G 83 Linux

Disk /dev/sda: 292.5 GiB, 314038026240 bytes, 613355520 sectors

But that is stretching my skill level. Do you have any further suggestions?

Thanks
Des

Did you look in /media?

I think so. Under /.kodi/media all I find is splash.png and SKINDEFAULT.jpg

Not .kodi/media.

cd /media

OK Sorry.

I found /media and there is a PiDrive folder in there that I created earlier /media/PiDrive as part of trying to get the /dev/sda to mount there. I used “sudo mount -t auto /dev/sda /media/PiDrive” but that gave me an error

I have the WD 1TB drive and it arrived unformatted. To check whether yours has any partitions defined:

sudo fdisk -l /dev/sda

If no partitions are listed, create a primary partition:

sudo fdisk /dev/sda

and type" n" to create a partition, “p” to make it primary and “1” to make it the first partition. Accept defaults for first and last sector to make the partition span the entire disk. When the partition has been created, you may like to change it to NTFS so it’s visible via Samba. To do this, type “t” and choose option “7”. Finally type “p” to display the partition table to check it looks OK. If you’re happy with it, type “w” to write the new partition table to the disk and “q” to quit fdisk.

[All this from memory, so don’t necessarily take it literally but it should help. Nothing changes on the disk until you type the “w”, so you can always abort with “q”.]

The partition will need to be formatted. Assuming NTFS:

sudo mkfs.ntfs -f -v -I -L Pi-Drive /dev/sda1

On reboot, you should find the disk auto-mounted under /media.

Good advice.

My only recommendation is to use exFAT over NTFS for simpler handling re. permissions. You’ll still retain good compatibility between OSMC and Windows.

1 Like

I believe @bromham gave you quite some details. if you want to use exFAT as suggested by @sam_nazarko the last command would be sudo mkfs.exfat -n Pi-Drive /dev/sda1 after a reboot it should be automatically mounted at /media/Pi-Drive

Or he can just format it in a Windows PC

1 Like

Yep, but would be less fun :slight_smile:
Also if doing so still need to remember to give a proper Label

Geez! Thanks Guys - great info.

I ran “sudo fdisk -l /dev/sda” and got the following

Disk /dev/sda: 292.5 GiB, 314038026240 bytes, 613355520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

It is the 314GB PiDRive. I just want to check before I continue. Am I correct in assuming the drive is not partitioned?

Correct - it’s not partitioned.

Wow Guys.

Great help - I got it working perfectly!

Fanrtastic. All exactly as I wanted. I’m extremely pleased with the setup.

Thanks for all the help.

Hi there!

Thank you very much for the help!
Even if it’s one year later I hope you are still there because I followed @bromham instructions :

I have the WD 1TB drive and it arrived unformatted. To check whether yours has any partitions defined:

sudo fdisk -l /dev/sda

If no partitions are listed, create a primary partition:

sudo fdisk /dev/sda

and type" n" to create a partition, “p” to make it primary and “1” to make it the first partition. Accept defaults for first and last sector to make the partition span the entire disk. When the partition has been created, you may like to change it to NTFS so it’s visible via Samba. To do this, type “t” and choose option “7”. Finally type “p” to display the partition table to check it looks OK. If you’re happy with it, type “w” to write the new partition table to the disk and “q” to quit fdisk.

[All this from memory, so don’t necessarily take it literally but it should help. Nothing changes on the disk until you type the “w”, so you can always abort with “q”.]

The partition will need to be formatted. Assuming NTFS:

sudo mkfs.ntfs -f -v -I -L Pi-Drive /dev/sda1

On reboot, you should find the disk auto-mounted under /media.

but I can’t do the last step as I get those results :

osmc@osmc:/media$ sudo fdisk -l /dev/sda
Disk /dev/sda: 349,3 GiB, 375049420800 bytes, 732518400 sectors
Geometry: 255 heads, 63 sectors/track, 45597 cylinders
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: sun
osmc@osmc:/media$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition number (1-8, default 1): 1
First sector (0-732515805, default 0): 0
Last sector or +sectors or +size{K,M,G,T,P} (0-732515805, default 732515805): 732515805

Created a new partition 1 of type 'Linux native' and of size 349,3 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 7
Changed type of partition 'Linux native' to 'SunOS var'.

Command (m for help): p
Disk /dev/sda: 349,3 GiB, 375049420800 bytes, 732518400 sectors
Geometry: 255 heads, 63 sectors/track, 45597 cylinders
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: sun

Device     Start       End   Sectors   Size Id Type      Flags
/dev/sda1      0 732515804 732515805 349,3G  7 SunOS var      

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

osmc@osmc:/media$ q
-bash: q : commande introuvable
osmc@osmc:/media$ cd /
osmc@osmc:/$ sudo mkfs.ntfs -f -v -I -L Pi-Drive /dev/sda1
Failed to access '/dev/sda1': Aucun fichier ou dossier de ce type
The device doesn't exist; did you specify it correctly?

Can you help me find out what is the problem please? :slight_smile:

That’s incorrect. If you want to run the Pi as a Samba server and attach the disk permanently to it, you should format it as ext4 - and leave it with a partition type of Linux native. You might choose NTFS if you physically want to move the disk between machines.

Your 1 TB disk is only showing 349 GiB, so you need to start again. Delete everything until you see 1 TB of free, unpartitioned space (fdisk option F) and try again to create a 1 TB primary partition.

Update: As @fzinken has pointed out, your disk is probably 349 GiB. Nevertheless, I’d recommend that you re-create it with a partition type of Linux native and format it as ext4 - unless you need to move it between machines.

2 Likes

I guess that “1 TB” was just in the instructions he quoted in his post. I guess he has a Pi drive which is 349G

3 Likes

You have changed the parttion type to Sun OS change it back to Linux

1 Like

Exactly ! Thank you @fzinken I will try to do that later today!

Thank you too @dillthedog my Pi Drive is only 349 GiB but I will do as you said for the partition :wink: