LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   access second drive partition by a name, not UUID--how? (https://www.linuxquestions.org/questions/linux-general-1/access-second-drive-partition-by-a-name-not-uuid-how-4175634095/)

dmcgarrett@optonline.net 07-15-2018 03:32 PM

access second drive partition by a name, not UUID--how?
 
The description says most of it already. I have a second drive, /dev/sdb and it has a
large partition of 129GiB. I found its UUID and added it to fstab, so it is mounted
at boot. (It is actually /dev/sdb9.) But in order to write to it, I need some way to
give it a name that the system recognizes, so I can just cd /media/somename/filename.
(I don't know where "media" came from--it seems to apply to the whole hard drive.)
This needs to work in PCLinuxOS, KDE5. Any assistance greatly appreciated.

--doug

PS: If there is a way of letting me know by email when this post is answered, I don't
know how to implement it, unless it is automatic.

yancek 07-15-2018 03:51 PM

If you have an entry in fstab, it should show the mount point which is where you would go to access it. If it is /media then navigate there. Is the second drive an external usb drive? If you have an entry in fstab you created you should know how to access it. A number of Linux systems will make external drives available in the /media directory. You can manually create a mount point such as sdb9 with the command as root: mkdir /mnt/sdb9 OR /mkdir /media/sdb9 or give it another name of your choosing. Might help if you indicated whether you have a mount point and what it is and also post the entry from fstab.

dmcgarrett@optonline.net 07-15-2018 09:48 PM

Here is the entire fstab:

# Entry for /dev/sda6 :
UUID=80790976-f729-4ff5-8ae3-3c3a1e6b24d4 / ext4 defaults 1 1
# Entry for /dev/sda2 :
UUID=67354859-78e0-4832-b5b2-73f0ca29c38b /boot ext4 defaults 1 2
# Entry for /dev/sda3 :
UUID=221a3243-142d-4b00-b511-17bffb48c3f1 /home ext4 defaults 1 2
none /proc proc defaults 0 0
# Entry for /dev/sda5 :
UUID=0ef821ed-8585-4bc3-92db-3b85bdf81007 swap swap defaults 0 0
# Entry for /dev/sda7 :
UUID=8c13a80e-939a-43e0-9ecb-90f9b5a6eae2 swap swap defaults 0 0
none /dev/pts devpts defaults 0 0
# Entry for /dev/sdb9
UUID=f257b89f-c268-4560-bd89-33c08e8fb940

***********************************************************
In gparted, it appears that there is no longer a "label" option, if that matters.

This is not an external drive. It is in the PC case with /dev/sda, where PCLOS lives. There is no other OS on the machine.

Here is a section I have copied, eliminated mistyped lines. There should be a directory in that partition called merlesmusic, but it doesn't show.

[root@linux1 doug]# mkdir /media/sdb9
[root@linux1 doug]# cd /media/sdb9
[root@linux1 sdb9]# ls -la
total 8
drwxr-xr-x 2 root root 4096 Jul 15 22:33 ./
drwxrwxr-x 10 root root 4096 Jul 15 22:33 ../
[root@linux1 sdb9]# ls -la
total 8
drwxr-xr-x 2 root root 4096 Jul 15 22:33 ./
drwxrwxr-x 10 root root 4096 Jul 15 22:33 ../
[root@linux1 /]# mkdir /mnt/sdb9
[root@linux1 /]# cd /sdb9
bash: cd: /sdb9: No such file or directory
[root@linux1 /]# cd /mnt/sdb9
[root@linux1 sdb9]# ls -la
total 8
drwxr-xr-x 2 root root 4096 Jul 15 22:35 ./
drwxr-xr-x 3 root root 4096 Jul 15 22:35 ../

I can't believe that I've been using Linux for about 20 years and I can't get this straight

If I open the file manager (Dolphin) and select 129.6 hard drive, it shows merlesmusic. I'm confused!

Thanx for the input--doug

syg00 07-15-2018 10:30 PM

The fstab entry needs to supply a mountpoint - /mnt/sdb9 that you created should do fine. See "man fstab" for the options you'll need to supply.
You then reference it by the mountpoint. Any linux filesystem should allow you to assign a label. Let's see this output.
Code:

sudo lsblk -f
df -hT


dmcgarrett@optonline.net 07-16-2018 12:23 PM

[root@linux1 doug]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ext4 a9ef7ac9-5355-4a6b-ba04-c109924a8a3f /media/a9ef7ac9-5355-4a6b-ba04-c109924a8a3f
├─sda2 ext4 67354859-78e0-4832-b5b2-73f0ca29c38b /boot
├─sda3 ext4 221a3243-142d-4b00-b511-17bffb48c3f1 /home
├─sda4
├─sda5 swap 0ef821ed-8585-4bc3-92db-3b85bdf81007 [SWAP]
├─sda6 ext4 80790976-f729-4ff5-8ae3-3c3a1e6b24d4 /
└─sda7 swap 8c13a80e-939a-43e0-9ecb-90f9b5a6eae2 [SWAP]
sdb
├─sdb1 ntfs 099AECF06FAAC2BB /media/099AECF06FAAC2BB
├─sdb2 vfat D26C-CF7C /media/D26C-CF7C
├─sdb3
├─sdb5 ext4 809fd892-ab93-410b-8a43-07f86e69e671 /media/809fd892-ab93-410b-8a43-07f86e69e671
├─sdb6 ext4 df4f1ab1-7682-43aa-b7ba-f1620cbc4b8a /media/df4f1ab1-7682-43aa-b7ba-f1620cbc4b8a
├─sdb7 swap 422594ad-aa6d-4bd7-8c88-c5149a8b2f57
├─sdb8 ext4 0096d25a-0ea7-4ec3-a90c-fcb5885f8ae3 /media/0096d25a-0ea7-4ec3-a90c-fcb5885f8ae3
└─sdb9 ext4 f257b89f-c268-4560-bd89-33c08e8fb940 /media/f257b89f-c268-4560-bd89-33c08e8fb940 <<<<<This one
sr0
sr1


will look at the man page for fstab again.
Thanks--doug

jefro 07-16-2018 01:24 PM

https://www.cyberciti.biz/faq/rhel-c...rtition-label/

michaelk 07-16-2018 03:16 PM

In addition, using /media is just a convention where desktops automatically mount removable media and filesystems. The system will create a subdirectories(s) under /media depending on distribution/version using the filesystems UUID or label.

I would generalize that all recent distribution/versions should recognize UUIDs or labels in the /etc/fstab so should not be a problem.

dmcgarrett@optonline.net 07-17-2018 01:26 PM

I went over the man page for fstab, and it looks to me like the copy I pasted is incomplete. Here is the complete file:

root@linux1 etc]# cat fstab
# Entry for /dev/sda6 :
UUID=80790976-f729-4ff5-8ae3-3c3a1e6b24d4 / ext4 defaults 1 1
# Entry for /dev/sda2 :
UUID=67354859-78e0-4832-b5b2-73f0ca29c38b /boot ext4 defaults 1 2
# Entry for /dev/sda3 :
UUID=221a3243-142d-4b00-b511-17bffb48c3f1 /home ext4 defaults 1 2
none /proc proc defaults 0 0
# Entry for /dev/sda5 :
UUID=0ef821ed-8585-4bc3-92db-3b85bdf81007 swap swap defaults 0 0
# Entry for /dev/sda7 :
UUID=8c13a80e-939a-43e0-9ecb-90f9b5a6eae2 swap swap defaults 0 0
none /dev/pts devpts defaults 0 0
# Entry for /dev/sdb9
UUID=f257b89f-c268-4560-bd89-33c08e8fb940

Obviously there is more information for the other partitions. I know what "defaults" means, but it seems there should be some "/name" then "ext4" before
an entry that says defaults, and then I don't understand the "1 2" after the other system partitions. (Yes, the file system is ext4.) Sorry that I'm such
a dope, but this is a bit beyond me. Thanx for your help and your patience! --doug

yancek 07-17-2018 03:04 PM

In your last post, #8, you posted your fstab contents. Look at your entry for sdb9 and compare it to the entries above for /, /boot, /home and note that you do not have the mount point listed nor the filesystem type or other otions. Options are explained in detail at the link below.

https://help.ubuntu.com/community/Fstab

If you created the mount point you referred to earlier (/media/sdb9), change the line below to add it, the filesystem and options which you can set to your needs after reviewing the link above. You don't need to name it sdb9 or put it under /media. Historically the convention has been to put mount points in the /mnt directory but obviously, it is not required.

Quote:

UUID=f257b89f-c268-4560-bd89-33c08e8fb940 /media/sdb9 ext4 defaults 1 2


All times are GMT -5. The time now is 09:49 AM.