![]() ![]() ![]() We used the same disk with both the UUID and label option, so it’s contents will be the same. We can also mount by label directly using the -L flag: # mount -L small_disk /mnt/new_disk This is doable because of the fstab entry that the mount command uses. We can mount the device the same way as with UUID, by specifying the mount point: # mount /mnt/new_disk/ If doing this step with the same device, remember to remove the UUID reference added in the previous step before adding another that uses label: LABEL=small_disk /mnt/new_disk ext4 defaults 0 0 With the label already set, we can reference it in /etc/fstab. Mounting the filesystem by label is practically the same. We’ll also need the mount point to exist, so we’ll create the directory we mentioned in the above entry: # mkdir /mnt/new_disk ![]() It will be different on any other system. Please note that the above example uses the same UUID we listed with blkid in the previous section. Using a text editor, we can add the following new fstab entry to the end of the file: UUID=17c1210c-8a88-42d6-b394-03f491415d5c /mnt/new_disk ext4 defaults 0 0 dev/mapper/rhel-swap swap swap defaults 0 0įrom the above output we can see the syntax we need to use in order to mount our disk by UUID. # After editing this file, run 'systemctl daemon-reload' to update systemd # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # Accessible filesystems, by reference, are maintained under '/dev/disk/'. # Created by anaconda on Mon Oct 28 13:22:28 2019 The configuration for mounting is in the /etc/fstab file, which we can print for this example. If we did not modify the disk options on install, the boot device will most likely be mounted by UUID. Using UUID to mount is the recommended way, so on a default RHEL8 install, we can already find an example on how to do this. The syntax is e2label : # e2label /dev/sdb "small_disk"Īnother query will show the new label set: # e2label /dev/sdbĪlso, the blkid utility we used earlier will also present the newly set label: # blkid | grep sdb The same utility is capable of setting the label. The empty line does not indicate error, but that the label attribute is not set on this device yet. In our current state, the output may be misleading, because no label is set so far for this device. We can print our device’s label with e2label. The bold output indicates our new disk, and also the UUID we searched for. ![]() To list the UUID of the devices present in our system, we’ll open a terminal, and use blkid: # blkid We created an ext4 filesystem on top of that partition, using mkfs.ext4. We partitioned the disk using fdisk, creating a single partition that occupies the whole new disk. To have a free disk to be used, we added another virtual disk to the machine, which appears as /dev/sdb with the size of 2 GB. The operating system is installed on /dev/sda, a 15 GB virtual hard drive. Our test machine is a simple virtual machine running RHEL 8. $ – requires given linux commands to be executed as a regular non-privileged user # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command Privileged access to your Linux system as root or via the sudo command. Requirements, Conventions or Software Version Used Software Requirements and Conventions Used Software Requirements and Linux Command Line Conventions Category ![]()
0 Comments
Leave a Reply. |