Thursday, 12 January 2017

Permanently mapping a USB storage device in Fedora 25

Quite often if you are dealing with scripts or want to ensure consistency with USB storage devices in Linux you will want to ensure that block device names are consistent.

We should firstly identify something distinguishable about the USB disk - we can run the following to identify something suited for this:

lsblk -f

or

blkid

/dev/sda1: UUID="11114956-82ab-4fb4-83eb-c1daa224842d" TYPE="ext4" PARTUUID="83020ff5-01"
/dev/sda2: UUID="111J-1gg3-wzKf-MGSB-IoM9-0vmR-SZhckf" TYPE="LVM2_member" PARTUUID="83020ff5-02"
/dev/sr0: UUID="0B09161C4f637420" LABEL="Oct 17 2016" TYPE="udf"
/dev/mapper/fedora-root: UUID="11162f0-0b95-4da8-80e0-32a4c522f78a" TYPE="ext4"
/dev/mapper/fedora-swap: UUID="11171de-33d0-49ec-baa1-edb0d7ef7a7a" TYPE="swap"
/dev/mapper/fedora-home: UUID="111180c0-f7c2-499d-a4e9-f282407a0e5c" TYPE="ext4"
/dev/sdc1: UUID="111c93c-6a96-4b52-8818-dfb9d17a1798" TYPE="ext4" PARTUUID="2568a1a2-01"

to get the UUID - which is a universal identifier we can use with fstab to ensure the correct partition is mapped to the appropriate mount point.

Then in fstab we can issue something like:

/dev/sdc1 /mnt/test ext4 defaults 0 1

0 comments:

Post a comment