How to update fstab file with UUID?

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











up vote
0
down vote

favorite












The following lines are defined in my /etc/fstab file.



My current fstab:



/dev/sdb /lpo/sda ext4 defaults,noatime 0 0
/dev/sdc /lpo/sdb ext4 defaults,noatime 0 0


From blkid we get:



/dev/sdb: UUID="14314872-abd5-24e7-a850-db36fab2c6a1" TYPE="ext4"
/dev/sdc: UUID="6d439357-3d20-48de-9973-3afb2a325eee" TYPE="ext4"


How to update my current fstab (the two lines) to use the UUID?



For example, if I create the following line (according to the man page) for /dev/sdb, is it correct?



UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /dev/sdb ext4 defaults,noatime 0 0









share|improve this question



























    up vote
    0
    down vote

    favorite












    The following lines are defined in my /etc/fstab file.



    My current fstab:



    /dev/sdb /lpo/sda ext4 defaults,noatime 0 0
    /dev/sdc /lpo/sdb ext4 defaults,noatime 0 0


    From blkid we get:



    /dev/sdb: UUID="14314872-abd5-24e7-a850-db36fab2c6a1" TYPE="ext4"
    /dev/sdc: UUID="6d439357-3d20-48de-9973-3afb2a325eee" TYPE="ext4"


    How to update my current fstab (the two lines) to use the UUID?



    For example, if I create the following line (according to the man page) for /dev/sdb, is it correct?



    UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /dev/sdb ext4 defaults,noatime 0 0









    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      The following lines are defined in my /etc/fstab file.



      My current fstab:



      /dev/sdb /lpo/sda ext4 defaults,noatime 0 0
      /dev/sdc /lpo/sdb ext4 defaults,noatime 0 0


      From blkid we get:



      /dev/sdb: UUID="14314872-abd5-24e7-a850-db36fab2c6a1" TYPE="ext4"
      /dev/sdc: UUID="6d439357-3d20-48de-9973-3afb2a325eee" TYPE="ext4"


      How to update my current fstab (the two lines) to use the UUID?



      For example, if I create the following line (according to the man page) for /dev/sdb, is it correct?



      UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /dev/sdb ext4 defaults,noatime 0 0









      share|improve this question















      The following lines are defined in my /etc/fstab file.



      My current fstab:



      /dev/sdb /lpo/sda ext4 defaults,noatime 0 0
      /dev/sdc /lpo/sdb ext4 defaults,noatime 0 0


      From blkid we get:



      /dev/sdb: UUID="14314872-abd5-24e7-a850-db36fab2c6a1" TYPE="ext4"
      /dev/sdc: UUID="6d439357-3d20-48de-9973-3afb2a325eee" TYPE="ext4"


      How to update my current fstab (the two lines) to use the UUID?



      For example, if I create the following line (according to the man page) for /dev/sdb, is it correct?



      UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /dev/sdb ext4 defaults,noatime 0 0






      linux mount partition fstab uuid






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 25 '17 at 18:52









      peterh

      3,97792755




      3,97792755










      asked Sep 25 '17 at 18:20









      yael

      2,0341145




      2,0341145




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /lpo/sda ext4 defaults,noatime 0 0
          UUID="6d439357-3d20-48de-9973-3afb2a325eee" /lpo/sdb ext4 defaults,noatime 0 0


          The format of entries in fstab are as follows:



          <file system> <dir> <type> <options> <dump> <pass>


          Where <file system> is the device you want to mount (such as /dev/sdb and <dir> is the path to where the device should be mounted (/lpo/sda in your case).



          There are multiple ways you can specify <file system>, the simplest being the path to the file system device in question /dev/sdb in your case (although typically they point to a partition on a drive rather than the drive, such as /dev/sdb1 but it appears that your drives lack a partition table and simply have the filesystem on the main device). But you can also use the device UUID or PARTUUID by specifying it as a key/value pair UUID="14314872-abd5-24e7-a850-db36fab2c6a1" inplace of /dev/sdb.



          The main reason to use UUID or PARTUUID instead of device paths is that they are more consistent when changing the physical disks. The devices are numbered according to how they are presented to the OS by the bios (which is normally ordered by the socket they are plugged into). This means that if you add in a new device or physically rearrange existing devices they will be renumbered and what was /dev/sdb before might not be now. As you can imagine this will result in the wrong disk being mounted to the wrong location. UUID and PARTUUID are ids that are written as part of formatting the filesystem for UUID or at the time of creating the partition in the case of PARTUUID. These numbers are written to the disk and will always remain the same so can be used to mount the correct disk even when the underlying device file gets renumbered.



          Side note: Your devices are a bit confusing - you have /dev/sdb mounted to /lpo/sda - while that works it can be confusing and lead to errors when you maintain/configuring your system, you may want to make these more consistent.






          share|improve this answer






















          • ok so when need to use the UUID instead the default conf ?
            – yael
            Sep 25 '17 at 18:41






          • 1




            @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
            – Michael Daffin
            Sep 25 '17 at 18:50










          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%2f394381%2fhow-to-update-fstab-file-with-uuid%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /lpo/sda ext4 defaults,noatime 0 0
          UUID="6d439357-3d20-48de-9973-3afb2a325eee" /lpo/sdb ext4 defaults,noatime 0 0


          The format of entries in fstab are as follows:



          <file system> <dir> <type> <options> <dump> <pass>


          Where <file system> is the device you want to mount (such as /dev/sdb and <dir> is the path to where the device should be mounted (/lpo/sda in your case).



          There are multiple ways you can specify <file system>, the simplest being the path to the file system device in question /dev/sdb in your case (although typically they point to a partition on a drive rather than the drive, such as /dev/sdb1 but it appears that your drives lack a partition table and simply have the filesystem on the main device). But you can also use the device UUID or PARTUUID by specifying it as a key/value pair UUID="14314872-abd5-24e7-a850-db36fab2c6a1" inplace of /dev/sdb.



          The main reason to use UUID or PARTUUID instead of device paths is that they are more consistent when changing the physical disks. The devices are numbered according to how they are presented to the OS by the bios (which is normally ordered by the socket they are plugged into). This means that if you add in a new device or physically rearrange existing devices they will be renumbered and what was /dev/sdb before might not be now. As you can imagine this will result in the wrong disk being mounted to the wrong location. UUID and PARTUUID are ids that are written as part of formatting the filesystem for UUID or at the time of creating the partition in the case of PARTUUID. These numbers are written to the disk and will always remain the same so can be used to mount the correct disk even when the underlying device file gets renumbered.



          Side note: Your devices are a bit confusing - you have /dev/sdb mounted to /lpo/sda - while that works it can be confusing and lead to errors when you maintain/configuring your system, you may want to make these more consistent.






          share|improve this answer






















          • ok so when need to use the UUID instead the default conf ?
            – yael
            Sep 25 '17 at 18:41






          • 1




            @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
            – Michael Daffin
            Sep 25 '17 at 18:50














          up vote
          3
          down vote



          accepted










          UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /lpo/sda ext4 defaults,noatime 0 0
          UUID="6d439357-3d20-48de-9973-3afb2a325eee" /lpo/sdb ext4 defaults,noatime 0 0


          The format of entries in fstab are as follows:



          <file system> <dir> <type> <options> <dump> <pass>


          Where <file system> is the device you want to mount (such as /dev/sdb and <dir> is the path to where the device should be mounted (/lpo/sda in your case).



          There are multiple ways you can specify <file system>, the simplest being the path to the file system device in question /dev/sdb in your case (although typically they point to a partition on a drive rather than the drive, such as /dev/sdb1 but it appears that your drives lack a partition table and simply have the filesystem on the main device). But you can also use the device UUID or PARTUUID by specifying it as a key/value pair UUID="14314872-abd5-24e7-a850-db36fab2c6a1" inplace of /dev/sdb.



          The main reason to use UUID or PARTUUID instead of device paths is that they are more consistent when changing the physical disks. The devices are numbered according to how they are presented to the OS by the bios (which is normally ordered by the socket they are plugged into). This means that if you add in a new device or physically rearrange existing devices they will be renumbered and what was /dev/sdb before might not be now. As you can imagine this will result in the wrong disk being mounted to the wrong location. UUID and PARTUUID are ids that are written as part of formatting the filesystem for UUID or at the time of creating the partition in the case of PARTUUID. These numbers are written to the disk and will always remain the same so can be used to mount the correct disk even when the underlying device file gets renumbered.



          Side note: Your devices are a bit confusing - you have /dev/sdb mounted to /lpo/sda - while that works it can be confusing and lead to errors when you maintain/configuring your system, you may want to make these more consistent.






          share|improve this answer






















          • ok so when need to use the UUID instead the default conf ?
            – yael
            Sep 25 '17 at 18:41






          • 1




            @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
            – Michael Daffin
            Sep 25 '17 at 18:50












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /lpo/sda ext4 defaults,noatime 0 0
          UUID="6d439357-3d20-48de-9973-3afb2a325eee" /lpo/sdb ext4 defaults,noatime 0 0


          The format of entries in fstab are as follows:



          <file system> <dir> <type> <options> <dump> <pass>


          Where <file system> is the device you want to mount (such as /dev/sdb and <dir> is the path to where the device should be mounted (/lpo/sda in your case).



          There are multiple ways you can specify <file system>, the simplest being the path to the file system device in question /dev/sdb in your case (although typically they point to a partition on a drive rather than the drive, such as /dev/sdb1 but it appears that your drives lack a partition table and simply have the filesystem on the main device). But you can also use the device UUID or PARTUUID by specifying it as a key/value pair UUID="14314872-abd5-24e7-a850-db36fab2c6a1" inplace of /dev/sdb.



          The main reason to use UUID or PARTUUID instead of device paths is that they are more consistent when changing the physical disks. The devices are numbered according to how they are presented to the OS by the bios (which is normally ordered by the socket they are plugged into). This means that if you add in a new device or physically rearrange existing devices they will be renumbered and what was /dev/sdb before might not be now. As you can imagine this will result in the wrong disk being mounted to the wrong location. UUID and PARTUUID are ids that are written as part of formatting the filesystem for UUID or at the time of creating the partition in the case of PARTUUID. These numbers are written to the disk and will always remain the same so can be used to mount the correct disk even when the underlying device file gets renumbered.



          Side note: Your devices are a bit confusing - you have /dev/sdb mounted to /lpo/sda - while that works it can be confusing and lead to errors when you maintain/configuring your system, you may want to make these more consistent.






          share|improve this answer














          UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /lpo/sda ext4 defaults,noatime 0 0
          UUID="6d439357-3d20-48de-9973-3afb2a325eee" /lpo/sdb ext4 defaults,noatime 0 0


          The format of entries in fstab are as follows:



          <file system> <dir> <type> <options> <dump> <pass>


          Where <file system> is the device you want to mount (such as /dev/sdb and <dir> is the path to where the device should be mounted (/lpo/sda in your case).



          There are multiple ways you can specify <file system>, the simplest being the path to the file system device in question /dev/sdb in your case (although typically they point to a partition on a drive rather than the drive, such as /dev/sdb1 but it appears that your drives lack a partition table and simply have the filesystem on the main device). But you can also use the device UUID or PARTUUID by specifying it as a key/value pair UUID="14314872-abd5-24e7-a850-db36fab2c6a1" inplace of /dev/sdb.



          The main reason to use UUID or PARTUUID instead of device paths is that they are more consistent when changing the physical disks. The devices are numbered according to how they are presented to the OS by the bios (which is normally ordered by the socket they are plugged into). This means that if you add in a new device or physically rearrange existing devices they will be renumbered and what was /dev/sdb before might not be now. As you can imagine this will result in the wrong disk being mounted to the wrong location. UUID and PARTUUID are ids that are written as part of formatting the filesystem for UUID or at the time of creating the partition in the case of PARTUUID. These numbers are written to the disk and will always remain the same so can be used to mount the correct disk even when the underlying device file gets renumbered.



          Side note: Your devices are a bit confusing - you have /dev/sdb mounted to /lpo/sda - while that works it can be confusing and lead to errors when you maintain/configuring your system, you may want to make these more consistent.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 25 '17 at 19:02

























          answered Sep 25 '17 at 18:37









          Michael Daffin

          2,6101517




          2,6101517











          • ok so when need to use the UUID instead the default conf ?
            – yael
            Sep 25 '17 at 18:41






          • 1




            @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
            – Michael Daffin
            Sep 25 '17 at 18:50
















          • ok so when need to use the UUID instead the default conf ?
            – yael
            Sep 25 '17 at 18:41






          • 1




            @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
            – Michael Daffin
            Sep 25 '17 at 18:50















          ok so when need to use the UUID instead the default conf ?
          – yael
          Sep 25 '17 at 18:41




          ok so when need to use the UUID instead the default conf ?
          – yael
          Sep 25 '17 at 18:41




          1




          1




          @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
          – Michael Daffin
          Sep 25 '17 at 18:50




          @yael Basically for consistency when the you add or remove disks - I have updated my answer with more details.
          – Michael Daffin
          Sep 25 '17 at 18:50

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394381%2fhow-to-update-fstab-file-with-uuid%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?