If I know that a partition is for example /dev/sda1 how can I get the disk name (/dev/sda in this case) that contains the partition ?  The output should be only a path to disk (like /dev/sda).  It shouldn't require string manipulation, because I need it to work for different disk types.
How to get disk name that contains a specific partition
linux;partition;disk;block device
You can observe in /sys the block device for a given partition name. Eg for /dev/sda1:$ ls -l /sys/class/block/sda1lrwxrwxrwx 1 root root /sys/class/block/sda1 -> \ ../../devices/pci0000:00/.../ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1A script to take arg /dev/sda1 and print /dev/sda is:part=$1part=${part#/dev/}disk=$(readlink /sys/class/block/$part)disk=${disk%/*}disk=/dev/${disk##*/}echo $diskI dont have lvm etc to try out, but there is probably some similar path.There is also lsblk:$ lsblk -as /dev/sde1NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsde1    8:65   1  7.4G  0 part `-sde   8:64   1  7.4G  0 disk and as @don_crissti said you can get the parent directly with:lsblk -no pkname /dev/sda1