How to tell if a block device is the same as one previously connected?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a block device. It is removed from the system and later added again. How can I verify that it is exactly the same device?



The device will always be a mass storage device (which I'm not planning to write to and will only mount read-only).



I could md5sum both devices and verify that the hashes match, but this is time consuming for large storage devices.



Is there a quicker method?







share|improve this question





















  • What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
    – sudodus
    Jun 15 at 13:47










  • @sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
    – Owen Pauling
    Jun 15 at 13:59














up vote
0
down vote

favorite












I have a block device. It is removed from the system and later added again. How can I verify that it is exactly the same device?



The device will always be a mass storage device (which I'm not planning to write to and will only mount read-only).



I could md5sum both devices and verify that the hashes match, but this is time consuming for large storage devices.



Is there a quicker method?







share|improve this question





















  • What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
    – sudodus
    Jun 15 at 13:47










  • @sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
    – Owen Pauling
    Jun 15 at 13:59












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a block device. It is removed from the system and later added again. How can I verify that it is exactly the same device?



The device will always be a mass storage device (which I'm not planning to write to and will only mount read-only).



I could md5sum both devices and verify that the hashes match, but this is time consuming for large storage devices.



Is there a quicker method?







share|improve this question













I have a block device. It is removed from the system and later added again. How can I verify that it is exactly the same device?



The device will always be a mass storage device (which I'm not planning to write to and will only mount read-only).



I could md5sum both devices and verify that the hashes match, but this is time consuming for large storage devices.



Is there a quicker method?









share|improve this question












share|improve this question




share|improve this question








edited Jun 15 at 14:01
























asked Jun 15 at 13:36









Owen Pauling

687




687











  • What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
    – sudodus
    Jun 15 at 13:47










  • @sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
    – Owen Pauling
    Jun 15 at 13:59
















  • What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
    – sudodus
    Jun 15 at 13:47










  • @sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
    – Owen Pauling
    Jun 15 at 13:59















What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
– sudodus
Jun 15 at 13:47




What kind of devices are you thinking of? The identification can be different depending of the kind of device. Mass storage devices (HDD, SSD, USB pendrive memory card), or also other devices, that are seen as block devices? Must the identification be fully automatic and 100 % reliable, or can you check/verify manually, so the automatic identification is only a help tool?
– sudodus
Jun 15 at 13:47












@sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
– Owen Pauling
Jun 15 at 13:59




@sudodus It will always be a mass storage device, and the identification has to be fully automatic and generally reliable (knowing it "might be a different device" and having to verify manually is okay if it means the automated method is fast, compared to 100% reliability but really slow).
– Owen Pauling
Jun 15 at 13:59










3 Answers
3






active

oldest

votes

















up vote
2
down vote













The output of fdisk -l $device includes a line starting 'Disk identifier:' with some detail from the device that is usually unique and persistent for it.
Illustration:



# fdisk -l /dev/sda | grep 'Disk identifier:'





share|improve this answer




























    up vote
    1
    down vote













    You could use the devices UUID.
    lsblk -f or blkid .



    UUID can be set (with tune2fs) but for most use cases it should be unique enough.






    share|improve this answer




























      up vote
      1
      down vote













      Hardcoded unique(?) ID



      Most mass storage devices (maybe not all) have a hardcoded unique ID, that is seen at /dev/disk/by-id. The following command line will show this ID,



      sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'


      and also show which block device it is represented by, '-> /dev/sdx'



      Example (my working computer with three USB pendrives connected),



      $ sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'

      ata-HL-DT-STDVD+-RW_GSA-H21L -> /dev/sr0
      ata-KINGSTON_SKC300S37A120G_50026B724703BCA8 -> /dev/sda
      ata-WDC_WD4002FYYZ-01B7CB1_K3GWHAEB -> /dev/sdb
      usb-Corsair_Voyager_GT_3.0_070883862E1B9719-0:0 -> /dev/sdc
      usb-SanDisk_Cruzer_Blade_200429068118E7C2CFFD-0:0 -> /dev/sde
      usb-SanDisk_Cruzer_Blade_200429068118F440A09E-0:0 -> /dev/sdd
      wwn-0x5000cca25ccc7f97 -> /dev/sdb
      wwn-0x50026b724703bca8 -> /dev/sda


      UUID of file system(s)



      If there are partitions with file systems, there are also UUIDs for each file system, and these are often but not always unique, depending on if they were created individually or cloned from some common original file system or image file. The UUIDs can be shown by blkid and by lsblkvia the following command line,



      lsblk -l -o name,size,UUID,model


      Example (my working computer with three USB pendrives connected),



      $ lsblk -l -o name,size,UUID,model
      NAME SIZE UUID MODEL
      sda 111,8G KINGSTON SKC300S
      sda1 106,9G 0ac1cb43-1609-4fc3-8c69-3e21299729bc
      sda2 5G 6d54c49d-31ac-45fe-917c-2335bcfe7399
      sdb 3,7T WDC WD4002FYYZ-0
      sdb1 510M 9F05-5B18
      sdb2 5G 08b7164f-8852-451b-9624-63b16a66359a
      sdb3 10G fa242ddd-90f8-4603-af5c-c89f4b71ac70
      sdb4 15G 491a6a2b-4867-44d5-94d8-082f79066a5a
      sdb5 1M
      sdb6 100G 44156f43-0958-4ea1-800d-b02afbc7d306
      sdb7 3,5T 862210fd-a6fd-4fe3-913c-e18e1448ef36
      sdb8 5G 6958d86a-57a9-4e40-8376-1e41258e5810
      sdc 29,5G Voyager GT 3.0
      sdc1 9,1G 38028BF9184E3FB4
      sdc2 1M
      sdc3 244M 4299-B748
      sdc4 1,8G 2018-04-26-18-43-51-00
      sdc5 18,4G 033ffb75-518d-4335-89cb-ef7d159cf20b
      sdd 3,7G 2016-08-24-07-06-03-00 Cruzer Blade
      sdd1 1,3G 2016-08-24-07-06-03-00
      sde 3,7G 2016-07-19-21-27-51-00 Cruzer Blade
      sde1 1,4G 2016-07-19-21-27-51-00
      sde2 2,3M 0F7B-9366
      sr0 1024M DVD+-RW GSA-H21L



      These methods are enough to help me identify the connected mass storage devices after a quick manual inspection.



      It is possible to use the hardcoded ID and/or the UUIDs automatically. For example, you can create a corresponding md5sum for every mass storage device that you have, and store the md5sums in variables in a shellscript, where you can check for matches.






      share|improve this answer





















        Your Answer







        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "106"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );








         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f450002%2fhow-to-tell-if-a-block-device-is-the-same-as-one-previously-connected%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        2
        down vote













        The output of fdisk -l $device includes a line starting 'Disk identifier:' with some detail from the device that is usually unique and persistent for it.
        Illustration:



        # fdisk -l /dev/sda | grep 'Disk identifier:'





        share|improve this answer

























          up vote
          2
          down vote













          The output of fdisk -l $device includes a line starting 'Disk identifier:' with some detail from the device that is usually unique and persistent for it.
          Illustration:



          # fdisk -l /dev/sda | grep 'Disk identifier:'





          share|improve this answer























            up vote
            2
            down vote










            up vote
            2
            down vote









            The output of fdisk -l $device includes a line starting 'Disk identifier:' with some detail from the device that is usually unique and persistent for it.
            Illustration:



            # fdisk -l /dev/sda | grep 'Disk identifier:'





            share|improve this answer













            The output of fdisk -l $device includes a line starting 'Disk identifier:' with some detail from the device that is usually unique and persistent for it.
            Illustration:



            # fdisk -l /dev/sda | grep 'Disk identifier:'






            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered Jun 15 at 20:39









            Ralph Rönnquist

            2,35738




            2,35738






















                up vote
                1
                down vote













                You could use the devices UUID.
                lsblk -f or blkid .



                UUID can be set (with tune2fs) but for most use cases it should be unique enough.






                share|improve this answer

























                  up vote
                  1
                  down vote













                  You could use the devices UUID.
                  lsblk -f or blkid .



                  UUID can be set (with tune2fs) but for most use cases it should be unique enough.






                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    You could use the devices UUID.
                    lsblk -f or blkid .



                    UUID can be set (with tune2fs) but for most use cases it should be unique enough.






                    share|improve this answer













                    You could use the devices UUID.
                    lsblk -f or blkid .



                    UUID can be set (with tune2fs) but for most use cases it should be unique enough.







                    share|improve this answer













                    share|improve this answer



                    share|improve this answer











                    answered Jun 15 at 14:47









                    Joe M

                    5964




                    5964




















                        up vote
                        1
                        down vote













                        Hardcoded unique(?) ID



                        Most mass storage devices (maybe not all) have a hardcoded unique ID, that is seen at /dev/disk/by-id. The following command line will show this ID,



                        sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'


                        and also show which block device it is represented by, '-> /dev/sdx'



                        Example (my working computer with three USB pendrives connected),



                        $ sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'

                        ata-HL-DT-STDVD+-RW_GSA-H21L -> /dev/sr0
                        ata-KINGSTON_SKC300S37A120G_50026B724703BCA8 -> /dev/sda
                        ata-WDC_WD4002FYYZ-01B7CB1_K3GWHAEB -> /dev/sdb
                        usb-Corsair_Voyager_GT_3.0_070883862E1B9719-0:0 -> /dev/sdc
                        usb-SanDisk_Cruzer_Blade_200429068118E7C2CFFD-0:0 -> /dev/sde
                        usb-SanDisk_Cruzer_Blade_200429068118F440A09E-0:0 -> /dev/sdd
                        wwn-0x5000cca25ccc7f97 -> /dev/sdb
                        wwn-0x50026b724703bca8 -> /dev/sda


                        UUID of file system(s)



                        If there are partitions with file systems, there are also UUIDs for each file system, and these are often but not always unique, depending on if they were created individually or cloned from some common original file system or image file. The UUIDs can be shown by blkid and by lsblkvia the following command line,



                        lsblk -l -o name,size,UUID,model


                        Example (my working computer with three USB pendrives connected),



                        $ lsblk -l -o name,size,UUID,model
                        NAME SIZE UUID MODEL
                        sda 111,8G KINGSTON SKC300S
                        sda1 106,9G 0ac1cb43-1609-4fc3-8c69-3e21299729bc
                        sda2 5G 6d54c49d-31ac-45fe-917c-2335bcfe7399
                        sdb 3,7T WDC WD4002FYYZ-0
                        sdb1 510M 9F05-5B18
                        sdb2 5G 08b7164f-8852-451b-9624-63b16a66359a
                        sdb3 10G fa242ddd-90f8-4603-af5c-c89f4b71ac70
                        sdb4 15G 491a6a2b-4867-44d5-94d8-082f79066a5a
                        sdb5 1M
                        sdb6 100G 44156f43-0958-4ea1-800d-b02afbc7d306
                        sdb7 3,5T 862210fd-a6fd-4fe3-913c-e18e1448ef36
                        sdb8 5G 6958d86a-57a9-4e40-8376-1e41258e5810
                        sdc 29,5G Voyager GT 3.0
                        sdc1 9,1G 38028BF9184E3FB4
                        sdc2 1M
                        sdc3 244M 4299-B748
                        sdc4 1,8G 2018-04-26-18-43-51-00
                        sdc5 18,4G 033ffb75-518d-4335-89cb-ef7d159cf20b
                        sdd 3,7G 2016-08-24-07-06-03-00 Cruzer Blade
                        sdd1 1,3G 2016-08-24-07-06-03-00
                        sde 3,7G 2016-07-19-21-27-51-00 Cruzer Blade
                        sde1 1,4G 2016-07-19-21-27-51-00
                        sde2 2,3M 0F7B-9366
                        sr0 1024M DVD+-RW GSA-H21L



                        These methods are enough to help me identify the connected mass storage devices after a quick manual inspection.



                        It is possible to use the hardcoded ID and/or the UUIDs automatically. For example, you can create a corresponding md5sum for every mass storage device that you have, and store the md5sums in variables in a shellscript, where you can check for matches.






                        share|improve this answer

























                          up vote
                          1
                          down vote













                          Hardcoded unique(?) ID



                          Most mass storage devices (maybe not all) have a hardcoded unique ID, that is seen at /dev/disk/by-id. The following command line will show this ID,



                          sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'


                          and also show which block device it is represented by, '-> /dev/sdx'



                          Example (my working computer with three USB pendrives connected),



                          $ sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'

                          ata-HL-DT-STDVD+-RW_GSA-H21L -> /dev/sr0
                          ata-KINGSTON_SKC300S37A120G_50026B724703BCA8 -> /dev/sda
                          ata-WDC_WD4002FYYZ-01B7CB1_K3GWHAEB -> /dev/sdb
                          usb-Corsair_Voyager_GT_3.0_070883862E1B9719-0:0 -> /dev/sdc
                          usb-SanDisk_Cruzer_Blade_200429068118E7C2CFFD-0:0 -> /dev/sde
                          usb-SanDisk_Cruzer_Blade_200429068118F440A09E-0:0 -> /dev/sdd
                          wwn-0x5000cca25ccc7f97 -> /dev/sdb
                          wwn-0x50026b724703bca8 -> /dev/sda


                          UUID of file system(s)



                          If there are partitions with file systems, there are also UUIDs for each file system, and these are often but not always unique, depending on if they were created individually or cloned from some common original file system or image file. The UUIDs can be shown by blkid and by lsblkvia the following command line,



                          lsblk -l -o name,size,UUID,model


                          Example (my working computer with three USB pendrives connected),



                          $ lsblk -l -o name,size,UUID,model
                          NAME SIZE UUID MODEL
                          sda 111,8G KINGSTON SKC300S
                          sda1 106,9G 0ac1cb43-1609-4fc3-8c69-3e21299729bc
                          sda2 5G 6d54c49d-31ac-45fe-917c-2335bcfe7399
                          sdb 3,7T WDC WD4002FYYZ-0
                          sdb1 510M 9F05-5B18
                          sdb2 5G 08b7164f-8852-451b-9624-63b16a66359a
                          sdb3 10G fa242ddd-90f8-4603-af5c-c89f4b71ac70
                          sdb4 15G 491a6a2b-4867-44d5-94d8-082f79066a5a
                          sdb5 1M
                          sdb6 100G 44156f43-0958-4ea1-800d-b02afbc7d306
                          sdb7 3,5T 862210fd-a6fd-4fe3-913c-e18e1448ef36
                          sdb8 5G 6958d86a-57a9-4e40-8376-1e41258e5810
                          sdc 29,5G Voyager GT 3.0
                          sdc1 9,1G 38028BF9184E3FB4
                          sdc2 1M
                          sdc3 244M 4299-B748
                          sdc4 1,8G 2018-04-26-18-43-51-00
                          sdc5 18,4G 033ffb75-518d-4335-89cb-ef7d159cf20b
                          sdd 3,7G 2016-08-24-07-06-03-00 Cruzer Blade
                          sdd1 1,3G 2016-08-24-07-06-03-00
                          sde 3,7G 2016-07-19-21-27-51-00 Cruzer Blade
                          sde1 1,4G 2016-07-19-21-27-51-00
                          sde2 2,3M 0F7B-9366
                          sr0 1024M DVD+-RW GSA-H21L



                          These methods are enough to help me identify the connected mass storage devices after a quick manual inspection.



                          It is possible to use the hardcoded ID and/or the UUIDs automatically. For example, you can create a corresponding md5sum for every mass storage device that you have, and store the md5sums in variables in a shellscript, where you can check for matches.






                          share|improve this answer























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            Hardcoded unique(?) ID



                            Most mass storage devices (maybe not all) have a hardcoded unique ID, that is seen at /dev/disk/by-id. The following command line will show this ID,



                            sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'


                            and also show which block device it is represented by, '-> /dev/sdx'



                            Example (my working computer with three USB pendrives connected),



                            $ sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'

                            ata-HL-DT-STDVD+-RW_GSA-H21L -> /dev/sr0
                            ata-KINGSTON_SKC300S37A120G_50026B724703BCA8 -> /dev/sda
                            ata-WDC_WD4002FYYZ-01B7CB1_K3GWHAEB -> /dev/sdb
                            usb-Corsair_Voyager_GT_3.0_070883862E1B9719-0:0 -> /dev/sdc
                            usb-SanDisk_Cruzer_Blade_200429068118E7C2CFFD-0:0 -> /dev/sde
                            usb-SanDisk_Cruzer_Blade_200429068118F440A09E-0:0 -> /dev/sdd
                            wwn-0x5000cca25ccc7f97 -> /dev/sdb
                            wwn-0x50026b724703bca8 -> /dev/sda


                            UUID of file system(s)



                            If there are partitions with file systems, there are also UUIDs for each file system, and these are often but not always unique, depending on if they were created individually or cloned from some common original file system or image file. The UUIDs can be shown by blkid and by lsblkvia the following command line,



                            lsblk -l -o name,size,UUID,model


                            Example (my working computer with three USB pendrives connected),



                            $ lsblk -l -o name,size,UUID,model
                            NAME SIZE UUID MODEL
                            sda 111,8G KINGSTON SKC300S
                            sda1 106,9G 0ac1cb43-1609-4fc3-8c69-3e21299729bc
                            sda2 5G 6d54c49d-31ac-45fe-917c-2335bcfe7399
                            sdb 3,7T WDC WD4002FYYZ-0
                            sdb1 510M 9F05-5B18
                            sdb2 5G 08b7164f-8852-451b-9624-63b16a66359a
                            sdb3 10G fa242ddd-90f8-4603-af5c-c89f4b71ac70
                            sdb4 15G 491a6a2b-4867-44d5-94d8-082f79066a5a
                            sdb5 1M
                            sdb6 100G 44156f43-0958-4ea1-800d-b02afbc7d306
                            sdb7 3,5T 862210fd-a6fd-4fe3-913c-e18e1448ef36
                            sdb8 5G 6958d86a-57a9-4e40-8376-1e41258e5810
                            sdc 29,5G Voyager GT 3.0
                            sdc1 9,1G 38028BF9184E3FB4
                            sdc2 1M
                            sdc3 244M 4299-B748
                            sdc4 1,8G 2018-04-26-18-43-51-00
                            sdc5 18,4G 033ffb75-518d-4335-89cb-ef7d159cf20b
                            sdd 3,7G 2016-08-24-07-06-03-00 Cruzer Blade
                            sdd1 1,3G 2016-08-24-07-06-03-00
                            sde 3,7G 2016-07-19-21-27-51-00 Cruzer Blade
                            sde1 1,4G 2016-07-19-21-27-51-00
                            sde2 2,3M 0F7B-9366
                            sr0 1024M DVD+-RW GSA-H21L



                            These methods are enough to help me identify the connected mass storage devices after a quick manual inspection.



                            It is possible to use the hardcoded ID and/or the UUIDs automatically. For example, you can create a corresponding md5sum for every mass storage device that you have, and store the md5sums in variables in a shellscript, where you can check for matches.






                            share|improve this answer













                            Hardcoded unique(?) ID



                            Most mass storage devices (maybe not all) have a hardcoded unique ID, that is seen at /dev/disk/by-id. The following command line will show this ID,



                            sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'


                            and also show which block device it is represented by, '-> /dev/sdx'



                            Example (my working computer with three USB pendrives connected),



                            $ sudo ls -l /dev/disk/by-id|grep -v '[1-9]$'|tr -s ' ' 't'|cut -f 9- | sed 's#../../#/dev/#'

                            ata-HL-DT-STDVD+-RW_GSA-H21L -> /dev/sr0
                            ata-KINGSTON_SKC300S37A120G_50026B724703BCA8 -> /dev/sda
                            ata-WDC_WD4002FYYZ-01B7CB1_K3GWHAEB -> /dev/sdb
                            usb-Corsair_Voyager_GT_3.0_070883862E1B9719-0:0 -> /dev/sdc
                            usb-SanDisk_Cruzer_Blade_200429068118E7C2CFFD-0:0 -> /dev/sde
                            usb-SanDisk_Cruzer_Blade_200429068118F440A09E-0:0 -> /dev/sdd
                            wwn-0x5000cca25ccc7f97 -> /dev/sdb
                            wwn-0x50026b724703bca8 -> /dev/sda


                            UUID of file system(s)



                            If there are partitions with file systems, there are also UUIDs for each file system, and these are often but not always unique, depending on if they were created individually or cloned from some common original file system or image file. The UUIDs can be shown by blkid and by lsblkvia the following command line,



                            lsblk -l -o name,size,UUID,model


                            Example (my working computer with three USB pendrives connected),



                            $ lsblk -l -o name,size,UUID,model
                            NAME SIZE UUID MODEL
                            sda 111,8G KINGSTON SKC300S
                            sda1 106,9G 0ac1cb43-1609-4fc3-8c69-3e21299729bc
                            sda2 5G 6d54c49d-31ac-45fe-917c-2335bcfe7399
                            sdb 3,7T WDC WD4002FYYZ-0
                            sdb1 510M 9F05-5B18
                            sdb2 5G 08b7164f-8852-451b-9624-63b16a66359a
                            sdb3 10G fa242ddd-90f8-4603-af5c-c89f4b71ac70
                            sdb4 15G 491a6a2b-4867-44d5-94d8-082f79066a5a
                            sdb5 1M
                            sdb6 100G 44156f43-0958-4ea1-800d-b02afbc7d306
                            sdb7 3,5T 862210fd-a6fd-4fe3-913c-e18e1448ef36
                            sdb8 5G 6958d86a-57a9-4e40-8376-1e41258e5810
                            sdc 29,5G Voyager GT 3.0
                            sdc1 9,1G 38028BF9184E3FB4
                            sdc2 1M
                            sdc3 244M 4299-B748
                            sdc4 1,8G 2018-04-26-18-43-51-00
                            sdc5 18,4G 033ffb75-518d-4335-89cb-ef7d159cf20b
                            sdd 3,7G 2016-08-24-07-06-03-00 Cruzer Blade
                            sdd1 1,3G 2016-08-24-07-06-03-00
                            sde 3,7G 2016-07-19-21-27-51-00 Cruzer Blade
                            sde1 1,4G 2016-07-19-21-27-51-00
                            sde2 2,3M 0F7B-9366
                            sr0 1024M DVD+-RW GSA-H21L



                            These methods are enough to help me identify the connected mass storage devices after a quick manual inspection.



                            It is possible to use the hardcoded ID and/or the UUIDs automatically. For example, you can create a corresponding md5sum for every mass storage device that you have, and store the md5sums in variables in a shellscript, where you can check for matches.







                            share|improve this answer













                            share|improve this answer



                            share|improve this answer











                            answered Jun 15 at 15:31









                            sudodus

                            47615




                            47615






















                                 

                                draft saved


                                draft discarded


























                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f450002%2fhow-to-tell-if-a-block-device-is-the-same-as-one-previously-connected%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Popular posts from this blog

                                Peggy Mitchell

                                Palaiologos

                                The Forum (Inglewood, California)