merkelbeek
Posts: 3
Joined: Tue May 05, 2020 7:57 pm

Give static name to USB

Tue May 12, 2020 7:08 pm

Hi All,

I have a raspberry pi Running with plex, Now i connect an external hardrive to it where my movies are stored on.
But everytime i unplug the device and replug it get's another name
first it was sda, the second time i plug it was sdb and nog its sdc. How can i make it static? so that it always is sdc?

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Give static name to USB

Tue May 12, 2020 7:19 pm

Use the PARTUUID.

Discover that with sudo blkid when the drive is plugged in.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

merkelbeek
Posts: 3
Joined: Tue May 05, 2020 7:57 pm

Re: Give static name to USB

Tue May 12, 2020 7:29 pm

It's my first day of linux lol
can you give more detailts about that?

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Give static name to USB

Tue May 12, 2020 8:30 pm

Open an LXterminal window run
sudo blkid

And you'll get something that looks like:

Code: Select all

pi@mercury:~ $ sudo blkid
/dev/mmcblk0p1: UUID="8C10-A11F" TYPE="vfat" PARTUUID="f9965871-01"
/dev/mmcblk0p2: UUID="9a7608bd-5bff-4dfc-ac1d-63a956744162" TYPE="ext4" PARTUUID="f9965871-02"
/dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="RECOVERY" LABEL="RECOVERY" UUID="6B9B-AF3E" TYPE="vfat" PARTUUID="314d5e11-01"
/dev/sda5: LABEL="root" UUID="39eb752a-27fb-4e4e-b38c-a1040200ec23" TYPE="ext4" PARTUUID="314d5e11-05"
/dev/sda6: LABEL="rootfs" UUID="26992cbf-74a1-4b6d-84eb-802b70f9fd9c" TYPE="ext4" PARTUUID="314d5e11-06"
/dev/mmcblk0: PTUUID="f9965871" PTTYPE="dos"
pi@mercury:~ $
So in my example to mount /dev/sda6 I'll use PARTUUID="314d5e11-06"

sudo mount PARTUUID=314d5e11-06 /media and /dev/sda6 will get mounted.

Code: Select all

pi@mercury:~ $ sudo mount PARTUUID=314d5e11-06 /media
pi@mercury:~ $ mount | grep media
/dev/sda6 on /media type ext4 (rw,relatime)
pi@mercury:~ $
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”