# Constantly changing drive letter for /dev/sdX

**URL:** <https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614>\
**Category:** Rocky Linux Help & Support\
**Created:** [August 26, 2024, 4:22pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614 "2024-08-26T16:22:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulg](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@paulg](https://forums.rockylinux.org/u/paulg)\
**Post date:** [August 26, 2024, 4:22pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/1 "2024-08-26T16:22:15Z")

</div>

I’m setting up a Rocky 9 server that has three drives in it - a mirrored drive for the OS, and 2 RAID 5 drives - one for home drives and one for shared data.  
I’ve tried mounting the drives in /etc/fstab both by the /dev/sdx reference and by UUID #. Yet every time the server reboots the /dev/sdx reference changes, I assume depending on the order in which the BIOS recognizes each device.  
How do I get these drives references to stay permanent and not change every reboot?  
Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![label](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@label](https://forums.rockylinux.org/u/label)\
**Post date:** [August 26, 2024, 5:17pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/2 "2024-08-26T17:17:12Z")

</div>

In /etc/fstab, you should be using UUID to get around the device name changes. Using `/dev/sdX` should be a no-go as it has never been a stable identifier. UUID will never change, unless you make a change to a file system/partition in some way.

If you insist on the `sdX` names to stay the same, you would need to use udev. Get the info you need from `udevadm info --name /dev/sdX` and then create your rules in for example `/etc/udev/rules.d/example.rules`.

See:

`/lib/udev/rules.d/60-persistent-storage.rules`

[https://www.freedesktop.org/software/systemd/man/latest/udev.html](https://www.freedesktop.org/software/systemd/man/latest/udev.html)

---

<div class="post-metadata">

**Author:** ![paulg](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@paulg](https://forums.rockylinux.org/u/paulg)\
**Post date:** [August 26, 2024, 8:11pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/3 "2024-08-26T20:11:30Z")

</div>

If I do a “blkid” I see the home drive partition and data partition listed as the following

/dev/sdc1:UUID"-long string-" TYPE-“LVM2\_member” PARTLABEL=“Linux filesystem” PARTUUID= “-long string-”  
/dev/sda1:UUID"-long string-" TYPE-“LVM2\_member” PARTLABEL=“Linux filesystem” PARTUUID= “-long string-”

Does that full string go in /etc/fstab?

---

<div class="post-metadata">

**Author:** ![paulg](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@paulg](https://forums.rockylinux.org/u/paulg)\
**Post date:** [August 26, 2024, 8:28pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/4 "2024-08-26T20:28:04Z")

</div>

Just to add some relevant into - just in case I might have done something wrong when creating the drive partitions

created paritions using gdisk; one partition on each disk utilizing entire disk, set type as 8e00  
ran “pvcreate dev/sda1” and “pvcreate /dev/sdc1”

ran “vgcreate fileshare /dev/sdc1” and “vgcreate home-drives /dev/sda1”

ran “lvcreate -l 100%VG -n fileshare fileshare” and “vgcreate -l 100%VG home-drives home-drives”

I tried to run “mkfs.xfs” on both but keep getting “can not open /dev/sdx1: device or resource busy” errors

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [August 26, 2024, 9:21pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/5 "2024-08-26T21:21:24Z")

</div>

> [@paulg](#):
>
> UUID"-long string-"
> 
> Does that full string go in /etc/fstab?

Something like:

```auto
UUID=-long-string- /where/you/want/it xfs defaults 0 0

```

> [@paulg](#):
>
> I tried to run “mkfs.xfs” on both but keep getting “can not open /dev/sdx1: device or resource busy” errors

You did create LV. Do you see `/dev/mapper/fileshare-fileshare` or something similar?  
That is the device where you want the filesystem. Not the `/dev/sdc1`.

---

<div class="post-metadata">

**Author:** ![paulg](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@paulg](https://forums.rockylinux.org/u/paulg)\
**Post date:** [August 26, 2024, 10:22pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/6 "2024-08-26T22:22:20Z")

</div>

Thank you jlehtone and nazunalika - between the 2 of you, that finally got me through this hurdle.

I used the /dev/mapper/fileshare-fileshare (etc) in /etc/fstab to mount the partitions - they do appear to persist across reboots.

So far, all seems well. Fingers crossed.

Thanks again.

---

<div class="post-metadata">

**Author:** ![paulg](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@paulg](https://forums.rockylinux.org/u/paulg)\
**Post date:** [August 26, 2024, 10:24pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/7 "2024-08-26T22:24:28Z")

</div>

The system only let me give credit for the solution to 1 person, but both of you should get credit for this.

Thanks again

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [October 25, 2024, 10:24pm UTC](https://forums.rockylinux.org/t/constantly-changing-drive-letter-for-dev-sdx/15614/8 "2024-10-25T22:24:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
