Solved server restart and change disk name?

Solved issue

soolan

Member
Joined
Jan 13, 2023
Messages
66
Reaction score
4
Credits
626
Hello
disk names change when i restart my server. What can I do to find the changed disk names easily. Also why does fdisk -l output two of the same disks? Here I am having a hard time choosing the disks during mounting.

Code:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 252G 0 252G 0% /dev
tmpfs 252G 0 252G 0% /dev/shm
tmpfs 252G 4.1G 248G 2% /run
tmpfs 252G 0 252G 0% /sys/fs/cgroup
/dev/sda3 526G 362G 139G 73% /
/dev/sda2 3.9G 278M 3.4G 8% /boot
/dev/sda1 4.0G 8.8M 4.0G 1% /boot/efi
tmpfs 51G 12K 51G 1% /run/user/42
/dev/sdb1 11T 9.9T 418G 97% /soolean
/dev/sdh1 2.0T 1.3T 589G 69% /abc2
/dev/sdd1 2.6T 1.6T 891G 65% /abc
tmpfs 51G 0 51G 0% /run/user/1010
tmpfs 51G 0 51G 0% /run/user/0

Code:
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 599.6 GB, 599550590976 bytes, 1170997248 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
Disk label type: gpt
Disk identifier: 65C382E9-A466-48D8-9BA2-975C2C5D9D15

# Start End Size Type Name
1 2048 8390655 4G EFI System EFI System Partition
2 8390656 16779263 4G Microsoft basic
3 16779264 1137440767 534.4G Microsoft basic
4 1137440768 1170995199 16G Linux swap
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 11991.0 GB, 11991011819520 bytes, 23419944960 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
Disk label type: gpt
Disk identifier: 5E8382CF-C4E2-43D3-A403-968658F9FAAA

# Start End Size Type Name
1 2048 23419944926 10.9T Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/mapper/mpathb: 11991.0 GB, 11991011819520 bytes, 23419944960 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
Disk label type: gpt
Disk identifier: 5E8382CF-C4E2-43D3-A403-968658F9FAAA

# Start End Size Type Name
1 2048 23419944926 10.9T Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdc: 2845.4 GB, 2845415833600 bytes, 5557452800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: gpt
Disk identifier: FE381698-6B16-4EEC-8983-E7F515D564B2

# Start End Size Type Name
1 2048 5557452766 2.6T Microsoft basic primary

Disk /dev/sdd: 2147.5 GB, 2147492036608 bytes, 4194320384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: dos
Disk identifier: 0x8b955527

Device Boot Start End Blocks Id System
/dev/sdd1 2048 4194320383 2097159168 83 Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sde: 2845.4 GB, 2845415833600 bytes, 5557452800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: gpt
Disk identifier: FE381698-6B16-4EEC-8983-E7F515D564B2

# Start End Size Type Name
1 2048 5557452766 2.6T Microsoft basic primary

Disk /dev/sdf: 2147.5 GB, 2147492036608 bytes, 4194320384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: dos
Disk identifier: 0x8b955527

Device Boot Start End Blocks Id System
/dev/sdf1 2048 4194320383 2097159168 83 Linux
 


Hello
disk names change when i restart my server. What can I do to find the changed disk names easily. Also why does fdisk -l output two of the same disks? Here I am having a hard time choosing the disks during mounting.

Code:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 252G 0 252G 0% /dev
tmpfs 252G 0 252G 0% /dev/shm
tmpfs 252G 4.1G 248G 2% /run
tmpfs 252G 0 252G 0% /sys/fs/cgroup
/dev/sda3 526G 362G 139G 73% /
/dev/sda2 3.9G 278M 3.4G 8% /boot
/dev/sda1 4.0G 8.8M 4.0G 1% /boot/efi
tmpfs 51G 12K 51G 1% /run/user/42
/dev/sdb1 11T 9.9T 418G 97% /soolean
/dev/sdh1 2.0T 1.3T 589G 69% /abc2
/dev/sdd1 2.6T 1.6T 891G 65% /abc
tmpfs 51G 0 51G 0% /run/user/1010
tmpfs 51G 0 51G 0% /run/user/0
Consistency in disk device names of the /dev/sda1 variety are no longer guaranteed to refer to the same disk on a machine in modern kernels because the disks are named as they are found by the kernel booting up, and the kernel doesn't always boot up in identical ways each time.

The resolution to the issue is to name the disks by using UUIDs or labels which you can find in the /dev directory such as is shown here:

Code:
[flip@flop ~]$ tree /dev/disk
<snip>
├── by-id
│   ├── ata-PIONEER_DVD-RW_DVR-219L_KFQC135763WL -> ../../sr0
│   ├── ata-ST1000DM003-1SB102_Z9A5LD6S -> ../../sda
│   ├── ata-ST1000DM003-1SB102_Z9A5LD6S-part1 -> ../../sda1
│   ├── ata-ST1000DM003-1SB102_Z9A5LD6S-part2 -> ../../sda2
│   ├── ata-ST1000DM003-1SB102_Z9A5LD6S-part3 -> ../../sda3
│   ├── ata-ST1000DM003-1SB102_Z9A5LD6S-part4 -> ../../sda4
│   ├── wwn-0x5000c500924deacb -> ../../sda
│   ├── wwn-0x5000c500924deacb-part1 -> ../../sda1
│   ├── wwn-0x5000c500924deacb-part2 -> ../../sda2
│   ├── wwn-0x5000c500924deacb-part3 -> ../../sda3
│   └── wwn-0x5000c500924deacb-part4 -> ../../sda4

<snip>

└── by-uuid
    ├── 201fc67c-6b76-4023-9191-ac4f9f17a45e -> ../../sda3
    ├── 67a70060-3e2c-484d-b8d5-31b5223439d5 -> ../../sda4
    ├── 9a02dae6-eb81-4209-af70-83c21811e4de -> ../../sda2
    └── D7B1-9618 -> ../../sda1

Wherever the disks need to be referenced, such as in /etc/fstab or /boot/grub/grub.cfg. if the user uses the UUID instead of the device ID such as /dev/sda4, the kernel will always know which device is being referred to because the UUIDs don't change so they identify the disk. Hence, in the example above, instead of using /dev/sda4, the problem is solved by using: 67a70060-3e2c-484d-b8d5-31b5223439d5.

The /etc/fstab entry could then be:

Code:
UUID=67a70060-3e2c-484d-b8d5-31b5223439d5 /home           ext4    defaults        0       2

Alternatively one can make their own labels with any names they choose using the e2label command so as to shorten the long UUID number. Interestingly, the UUID number, is actually coded where, for example, the first digit of the third group of numbers has a meaning ... in this case, the 4 means it's a random ID, except for the number 4.

As for the LVM aspect, I don't use it so can't say more.
 
Last edited:
I don't understand which disk to mount

Code:
Disk /dev/sde: 2147.5 GB, 2147492036608 bytes, 4194320384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: dos
Disk identifier: 0x8b955527

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1            2048  4194320383  2097159168   83  Linux

Disk /dev/sdf: 2147.5 GB, 2147492036608 bytes, 4194320384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk label type: dos
Disk identifier: 0x8b955527

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048  4194320383  2097159168   83  Linux
 
sdc is 2.6 TB sdd and sdf is 2.6 TB Which one do I need to mount?

Code:
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sdf           8:80   0     2T  0 disk
sdd           8:48   0   2.6T  0 disk
└─sdd1        8:49   0   2.6T  0 part
sdb           8:16   0  10.9T  0 disk
└─mpathb    252:0    0  10.9T  0 mpath
  └─mpathb1 252:1    0  10.9T  0 part
sde           8:64   0     2T  0 disk
sdc           8:32   0   2.6T  0 disk
└─sdc1        8:33   0   2.6T  0 part
sda           8:0    0 558.4G  0 disk
├─sda4        8:4    0    16G  0 part  [SWAP]
├─sda2        8:2    0     4G  0 part  /boot
├─sda3        8:3    0 534.4G  0 part  /
└─sda1        8:1    0     4G  0 part  /boot/efi
 
The output in post #4 shows that the root partition is on /dev/sda3, so that disk, the first one (sda), is the one that is running as a system. If you want access to any of the other disks (i.e. sdb, sdc, sde, sdf), then any of those can be mounted to gain access to their data.

As to your question "Which one do I need to mount?", that depends on what data you wish to access and where it is located. If you are unsure, you can mount any disk, inspect its contents and if it's not the one you want, unmount it, and mount another one.

If mounting, they would usually be mounted on a suitable mount point in the filesystem on the first disk (sda). A user can make mount points wherever it suits them, for example, by creating a directory for the purpose such /mounts and then within /mounts, creating directories which can be used as mount points like b, c, d, e, for each disk respectively. That's just one way of many possible options.

It's probably wise to keep the system's /mnt directory free for more temporary mounts one might need during work on the computer.
 
Hi,

the best way is to use the uuid of the partition for mount or if not already installed give the partition a label and use the label for mount. Backround is the devices are named by reaction time on boot so its russian roulete what disk is the first.
 

Staff online

Members online


Top