I'm writing a script that will copy all of the files on a device to a directory. The problem is that some of the devices have multiple partitions and some of the partitions don't have filesystems to copy files from. At the moment, I'm thinking about using lsblk to get a list of partitions on the device and file -s to check for a filesystem on each partition.Is there a less brute way to do what I am trying to do?Here is information regarding the empty partition problem:# /dev/sdb is a flashdrive with two partitions# /dev/sdb1 has no filesystem# /dev/sdb2 has an ext4 partition$ lsblk -fi...sdb    vfat   CARRIER-R C84B-6A72                            |-sdb1 vfat   CARRIER-R C84B-6A72                            `-sdb2 ext4   CARRIER-R 33ebb632-68a5-4bf5-bd29-90733af9699e...$ lsblk -ln -o NAME,FSTYPE...sdb  vfatsdb1 vfatsdb2 ext4...# As confirmation, mounting the partition fails$ mount -t auto /dev/sdb1 /mntmount: wrong fs type, bad option, bad superblock on /dev/sdb1...$ dmesg | tail...[  985.933627] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem[  985.935722] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem[  985.937603] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem[  985.939623] FAT-fs (sdb1): invalid media value (0xa7)[  985.939627] FAT-fs (sdb1): Can't find a valid FAT filesystem
Finding all partitions with filesystems
filesystems;partition;block device
I don't think lsblk and file -s is that ugly, but there is an alternate way.You can use blkid instead. By default, blkid without any arguments will list the known block devices, and a little bit of information about them, including the filesystem type. The format is also in key=value pair format (by default), which makes it easy to dump into a script.This is what the output looks like on my system:>> blkid/dev/sda1: LABEL=boot UUID=5F6E-FD2B TYPE=vfat /dev/sda2: UUID=yBVbC2-MFnP-1T1s-9XGz-VCUH-S5oG-aNSXDg TYPE=LVM2_member /dev/mapper/sys-root: UUID=0e1e5a6b-31b2-4e13-9b26-cbbb74e95ab9 TYPE=xfs /dev/mapper/sys-var--log: UUID=49f1b45d-d303-4c2e-a72b-c75e8f1e27ae TYPE=xfs /dev/mapper/sys-usr--portage: UUID=b8a494dd-f7f4-4e5e-9975-e21a61c95d22 TYPE=xfs /dev/mapper/sys-stmp: UUID=f2b3252c-3ec2-4c66-bed2-26c93f12b535 TYPE=xfs /dev/mapper/sys-home--phemmer--luks: UUID=898f9f52-3c9d-475c-9e7b-1a2263778a39 TYPE=crypto_LUKS /dev/mapper/_dev_dm_4: UUID=d0cb5255-e35a-4ee2-94ca-f1a7f7339eb9 TYPE=xfs 