Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: A question about fstab

  1. #1
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    550

    Default A question about fstab

    My fstab file contains lines such as these:

    Code:
    /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part2 /tmp                 ext4       acl,user_xattr        1 2
    /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part3 /var                 ext4       acl,user_xattr        1 2
    /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part4 /home                ext4       acl,user_xattr        1 2
    /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part1 swap                 swap       defaults              0 0
    /dev/disk/by-path/pci-0000:00:11.0-scsi-1:0:0:0-part1 /boot/efi            vfat       umask=0002,utf8=true  0 0
    Looks a little messy. I was looking at the man page and came across this under device identification:
    Code:
    The recommended setup is to use tags (e.g. LABEL=<label>) rather
    than /dev/disk/by-{label,uuid,partuuid,partlabel} udev  symlinks
    in  the  /etc/fstab file. The tags are more readable, robust and
    portable. The mount(8) command internally uses udev symlinks, so
    use  the  symlinks in /etc/fstab has no advantage over the tags.
    For more details see libblkid(3).
    I don't understand that ststement. It would seem that I can replace the "/dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part4" portion of the line with a label such as "DRIVE-2-4" but I don't see where to define the label. Or, perhaps I misunderstand the whole thing. Can anyone explain this to me?

    And, where is (can I get) documentation for libblkid?
    Bart

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,495
    Blog Entries
    3

    Default Re: A question about fstab

    You can use "e2label" to define a label for each "ext4" partition (or "ext2" or "ext3").

    You should be able to label your vfat partition with "dosfslabel", or you could give it a label when running Windows. And "swaplabel" should be able to set a label to your swap partition.

    Alternatively, you can use UUID= in "fstab". You can find the UUID with the "blkid" command.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,703

    Default Re: A question about fstab

    Also I think you can set labels in Yast

  4. #4
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    550

    Default Re: A question about fstab

    Quote Originally Posted by nrickert View Post
    You can use "e2label" to define a label for each "ext4" partition (or "ext2" or "ext3").

    You should be able to label your vfat partition with "dosfslabel", or you could give it a label when running Windows. And "swaplabel" should be able to set a label to your swap partition.

    Alternatively, you can use UUID= in "fstab". You can find the UUID with the "blkid" command.
    You mean the actual disk label? Do I replace

    Code:
    /dev/disk/by-path/pci-0000:00:11.0-scsi-2:0:0:0-part2 /tmp                 ext4       acl,user_xattr        1 2
    With
    Code:
    LABEL=suse131-tmp  /tmp ext4 <parameters> 1 2
    Assuming suse131-tmp is the disk label of the partition connected to pci-0000:00:11.0-scsi-2:0:0:0-part2 ?


    I don't like using the UUID because it makes changing out a hard drive harder.

    Bart

  5. #5
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: A question about fstab

    On 2015-02-06 03:26, montana suse user wrote:

    > You mean the actual disk label? Do I replace


    Yes.

    --
    Cheers / Saludos,

    Carlos E. R.

    (from 13.1 x86_64 "Bottle" (Minas Tirith))

  6. #6
    Join Date
    Nov 2013
    Location
    Kamloops, BC, Canada
    Posts
    3,974

    Default Re: A question about fstab

    Quote Originally Posted by gogalthorp View Post
    Also I think you can set labels in Yast
    ... Partitioner.

    Edit partition, choose mount by label, fill in the label (but make certain Format is not checked!).
    -Gerry Makaro
    Fraser-Bell Info Tech
    Solving Tech Mysteries since the Olden Days!
    ~~
    If I helped you, consider clicking the Star at the bottom left of my post.

  7. #7
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    550

    Default Re: A question about fstab

    For some reason, I had in mind that the label mentioned was in the file itself kinda like in a source.c file.

    #define LABEL=<whatever>

    I'm glad I checked.

    I already have all my partitions labeled.

    Thanks guys! I'm gonna make my file look nice and neat.

    Bart

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,998

    Default Re: A question about fstab

    You can see all possibilities in /dev/disk/
    Code:
    henk@boven:~> ls -l /dev/disk
    totaal 0
    drwxr-xr-x 2 root root 700  6 feb 09:16 by-id
    drwxr-xr-x 2 root root 140  6 feb 09:16 by-label
    drwxr-xr-x 2 root root 280  6 feb 09:16 by-path
    drwxr-xr-x 2 root root 140  6 feb 09:16 by-uuid
    henk@boven:~>
    E.g. to check which possibilities I have at this moment in time for the partition /dev/sda5:
    Code:
    henk@boven:~> ls -l /dev/disk/by* | grep sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 ata-Hitachi_HDT725032VLA380_VFJ201R23XUEXW-part5 -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 scsi-1ATA_Hitachi_HDT725032VLA380_VFJ201R23XUEXW-part5 -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 scsi-SATA_Hitachi_HDT72503_VFJ201R23XUEXW-part5 -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 wwn-0x5000cca311f7606f-part5 -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 System_B -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 pci-0000:00:1f.2-scsi-0:0:0:0-part5 -> ../../sda5
    lrwxrwxrwx 1 root root 10  6 feb 09:16 67aabbdc-41c8-4c4c-a965-4ff46768c4cf -> ../../sda5
    henk@boven:~>
    These are all the symlinks created by udev for this partitions. You see there is a by-label in my case (System_B).

    While many terms are used for these labels, I think the term "Volume Lable" is the correct one. They label the Volume, which in this case is the file system (not the partition) They are in the file system and that explaines why they are set using file system dependent tools (mentioned above) and not partition tools ¹).

    ¹) The term "Partitioner" is often used wrongly. Often, "Partitioners" (like YaST > System > Partitioner), combine the partitioning (working on the partition table) with actions on file systems (creating, maybe enlarging, etc. of certain file system types). And YaST Partitioner also can do other tasks like Volume labeling, maintaining fstab entries. All very usefull, but it blurs the meaning of "partitioning". A strict partitioning tool is e.g. fdisk.
    Henk van Velden

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,998

    Default Re: A question about fstab

    BTW, you can use the LABEL= feature, or mount by using /dev/disk/by-label/.... symlink (that is the same method the /dev/disk/by-path/... you seem to use now and the /dev/disk/by-id/... that is openSUSEE's default.

    I do not understand why the one method is more "nice and neat" (but that ii of course at least partly personal taste) then the other. All variations on the by-... theme have their advantages and disadvantages and one should contemplate about those before deviating from the openSUSE deafult IMHO. And when you decide for by-label for one or more of them, you then can decide if you think it more "nice and clean" to use the specific fstab feature above the symlink way.
    Henk van Velden

  10. #10
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,703

    Default Re: A question about fstab

    Labels must be unique to the system ie you can't mount a partition with the same label as an exiting one. So if you clone the drive those cloned partitions can not be mounted in the running system. When you use labels you take full charge ie you are the captain of the ship. Not a bad thing just that you must be aware and control all the mounts appropriately

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •