Main system is on sdb (ssd). Got an HDD on sda1 (that's the partition I want to use), but getting permission denied when doing anything on it. Want it to be mounted and ready for use each time I boot the computer like it's regular space for downloading stuff.
Lubuntu 18.04.2
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
└─sda1 8:1 0 436G 0 part
sdb 8:16 0 74.5G 0 disk
├─sdb1 8:17 0 512M 0 part /boot/efi
└─sdb2 8:18 0 74G 0 part /
sr0 11:0 1 1024M 0 rom 8 2 Answers
First you need to unmount it (Remember to use sudo)-
sudo umount /dev/sda1
Then you need to properly mount it but before that double-check
lsblk
Make sure this is the partition you want to mount
Create a directory in /mnt/ with your favorite name say 'sda1'
sudo mkdir /mnt/sda1
Now mount the partition to the directory
sudo mount /dev/sda1 /mnt/sda1
- create a mount point you want to use
sudo mkdir /data
Where you create the directory is up to you, I have a few in my / (root) directory to save typing when I refer to them. 'data' is used as an example.
- get details of your drive/partitions
guiverc@d960-ubu2:~$ sudo blkid |grep UUID /dev/sda1: UUID="afa7971f-3dd5-4b30-9c98-0af3e56a6f2b" TYPE="ext4" PARTUUID="6c8394c6-01" /dev/sda2: UUID="4f59600e-1f6b-4e3a-a466-941a2168e327" TYPE="swap" PARTUUID="6c8394c6-02" /dev/sda4: UUID="06863296-81b3-4263-8665-21f1864fa399" TYPE="xfs" PARTUUID="6c8394c6-04" /dev/sda5: UUID="5b4267e5-8b90-4f6b-84b0-c4ee9d5e104d" TYPE="ext4" PARTUUID="6c8394c6-05" /dev/sda6: UUID="ba0dca2e-0799-4340-b565-a649842c8a69" TYPE="xfs" PARTUUID="6c8394c6-06" guiverc@d960-ubu2:~$ cat /etc/fstab|grep UUID UUID=afa7971f-3dd5-4b30-9c98-0af3e56a6f2b / ext4 errors=remount-ro 0 1 UUID=06863296-81b3-4263-8665-21f1864fa399 /home xfs defaults 0 0 UUID=4f59600e-1f6b-4e3a-a466-941a2168e327 none swap sw 0 0
You'll note the detail for /sda6 (which I don't refer to by /dev/sda6 as those numbers can change if bios configuration is altered. partitioning changes, etc - I use the more precise UUID or unique-identifier for the partition.
The 'xfs' parameter you will need to change to reflect the type of file-system you are use for that partition, i use 'xfs' obviously, but you could say 'ext4' if that's what you use, or your type of fs. From man fstab some examples are :-
The third field (fs_vfstype). This field describes the type of the filesystem. Linux supports many filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs, hfsplus, tmpfs, sysfs, proc, iso9660, udf, squashfs, nfs, cifs, and many more. For more details, see mount(8).
- Add new entry to your file-system table (/etc/fstab)
You adjust what you learned in prior steps to your drive/partition entries. Your best examples of course will not be mine, but your own existing entries in /etc/fstab or your own file-system table. This will create a line you add below the already existing entries in your 'fstab' file. I'd also suggest adding a comment to it as to who made change, why, for example
\# adding my /dev/sda6 so it'll automount - guiverc/2019-03
UUID=ba0dca2e-0799-4340-b565-a649842c8a69 /data xfs defaults 0 0What editor you use to edit /etc/fstab to add the additional entry is up to you, but you'll need to elevate your privileges, for example sudo vim /etc/fstab. It can also be done by GUI, but I find commands far faster.
You can then test with sudo mount /data, and it should automount in subsequent boots.