how to know what is disk uuid for md raid1 and hdparm?

MealstroM asked:

ive got md0 (raid 1) array and want to make write cache off on them during system boot (ubuntu 12.04 server).

md0: /dev/sda /dev/sdc

blkid:

/dev/sda: UUID="3e502de5-696d-f4b4-470e-XXX" TYPE="linux_raid_member" 
/dev/sdb1: UUID="4ba40aae-65e2-416b-8f17-XXX" TYPE="ext2" 
/dev/sdb5: UUID="LNt5uO-ZFik-eQ0g-BEhP-FDLi-XXX" TYPE="LVM2_member" 
/dev/md0: UUID="a7eb2443-c3be-45e6-a3eb-XXX" TYPE="ext4" 
/dev/mapper/mydev-root: UUID="b560f808-db97-4a56-bbf1-XXX" TYPE="ext4" 
/dev/sdc: UUID="3e502de5-696d-f4b4-470e-XXX" TYPE="linux_raid_member" 
/dev/mapper/mydev-swap_1: UUID="49b806fe-95a6-4ddf-9c47-XXX" TYPE="swap" 

hdparm -W 0 /dev/sda (or /dev/sdc) works ok, but this letters could be changed during boot. and i want to use this via disk-uuid.

*stat /dev/disk/by-uuid/

 File: `/dev/disk/by-uuid/4ba40aae-65e2-416b-8f17-XXX' -> `../../sdb1'
 File: `/dev/disk/by-uuid/a7eb2443-c3be-45e6-a3eb-XXX' -> `../../md0'
 File: `/dev/disk/by-uuid/49b806fe-95a6-4ddf-9c47-XXX' -> `../../dm-1'
 File: `/dev/disk/by-uuid/b560f808-db97-4a56-bbf1-XXX' -> `../../dm-0'

if i use hdparm -W 0 /dev/disk/by-uuid/a7eb2443-c3be-45e6-a3eb-XXX — this fails.

/sdb1 -- system hdd
/dm-0 -- /boot on sdb1
/dm-1 -- /root on sdb1

I’m trying to use native /etc/hdparm.conf to disable write_cache on disk-by-uuid.

i dont want to write some script to check what /dev/sdX i should use with hdparm, so im asking what to do. Please help.

My answer:


You’ve tried to use hdparm on the by-uuid device file corresponding to your RAID array (md0). Instead, try running it on the ones corresponding to the physical disks.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.