mount extra hard drives

Hi!

Beginners question about mounting hard drives.
I have been following this guide:
https://en.opensuse.org/SDB:Mount_additional_disk

Maybe first I paste the output to show you what disks I have and then ask questions.

> sudo fdisk -l
[sudo] password for root: 
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Disk model: SAMSUNG MZ7LM240
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000d6c8c

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            2048 264253439 264251392  126G 82 Linux swap / Solaris
/dev/sda2  *    264253440 353429503  89176064 42.5G 83 Linux
/dev/sda3       353429504 468862127 115432624   55G 83 Linux


Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: TOSHIBA MG04ACA4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 467D5237-7570-4E6D-8880-B4FC74EE32E4

Device          Start        End    Sectors  Size Type
/dev/sdb1          34     262177     262144  128M Microsoft reserved
/dev/sdb2      264192 3908694015 3908429824  1.8T Linux RAID
/dev/sdb3  3908694016 7814035455 3905341440  1.8T Linux RAID

Partition 1 does not start on physical sector boundary.


Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: TOSHIBA MG04ACA4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 36DCF6CE-F64D-4D93-98BD-E8D7DE56D6FC

Device          Start        End    Sectors  Size Type
/dev/sdc1        2048 3908421631 3908419584  1.8T Linux RAID
/dev/sdc2  3908421632 7814035455 3905613824  1.8T Linux RAID


GPT PMBR size mismatch (1 != 7814037167) will be corrected by write.
Disk /dev/sdd: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: HGST HUS724040AL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 306588A1-2CA4-4D52-A14C-2C8A22715216

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 7814035455 7814033408  3.7T Microsoft basic data

So, I know this is going to sound weird to some of you, but I inherited a somewhat supported computer but now need to learn to administer it myself. That is why I am asking about everything.

  1. How many disks I have.
    So my first question is if I understand the output correctly. I have 4 disks, meaning I need to mount 3 of them now.
    I was actually aware of 3 disks, so maybe I am missing something here, not sure.

Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk /dev/sdd: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors

sdb and sdc are both
Disk model: SAMSUNG MZ7LM240
but with different identifiers and partitioning. So I guess fdisk does not lie and it is 2 actual physical drives I have that happen to be the same model.

  1. The same disks in dolphin.
    The one where Linux is installed (that is the * right?), I can see the two partitions in dolphin, I know which one is which one by size.

Sidenote: If you are wondering why is the SWAP so gigantic, I discussed this earlier. I sometimes needed a lot of memory in the past (up tp 256G), it is perhaps an overkill and it would be good for me to learn how to monitor my actual needs, but I will worry about his at a later point.

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 264253439 264251392 126G 82 Linux swap / Solaris
/dev/sda2 * 264253440 353429503 89176064 42.5G 83 Linux
/dev/sda3 353429504 468862127 115432624 55G 83 Linux

I can see one additional disk in dolphin under ‘Devices’. I mounted it, see below.

MAIN QUESTION:
what about the other disks?

What do I do to mount and access all these partitions sdb2, sdb3, sdc1, sdc2
I am skipping this reserved partition, not sure I need it but maybe I could use this at some point for other Linux distribution installs for running certain tools in a stable environment, but let’s skip this for now. I need to learn a lot more before I get to that point, and now what I want apart from not having to update everything for tools that are not well supported.

Device Start End Sectors Size Type
/dev/sdb1 34 262177 262144 128M Microsoft reserved
/dev/sdb2 264192 3908694015 3908429824 1.8T Linux RAID
/dev/sdb3 3908694016 7814035455 3905341440 1.8T Linux RAID
Device Start End Sectors Size Type
/dev/sdc1 2048 3908421631 3908419584 1.8T Linux RAID
/dev/sdc2 3908421632 7814035455 3905613824 1.8T Linux RAID

From dolphin I can not see which of the extra disks is already mounted there.
Following the guidelines I looked up the UUID in dolphin, from the path /run/media/user/UUID/
The suggested file system in the example is xfs but I dont understand yet if one can simply choose that.
I found file system under preferences for that specific Device (ext4) so I mounted it using that information.
I can also see that all other lines in fstab have 0 0 in the last columns instead of the recomended ‘1 2’. According to my googling this is not a big deal.
It was slightly confusing to know how should the line formatting look like, if that is spaces, tabs, or specific position - positions aligned with the lines above seems to work fine anyway.

> sudo cat /etc/fstab
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /                       btrfs  defaults                      0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=7cb193c3-d707-4426-9297-086f85b4edfb  swap                    swap   defaults                      0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /.snapshots             btrfs  subvol=/@/.snapshots          0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /var                    btrfs  subvol=/@/var                 0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /tmp                    btrfs  subvol=/@/tmp                 0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /root                   btrfs  subvol=/@/root                0  0
UUID=dcdc1772-2bfa-4a91-a066-bf8b0d40017d  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=bb672245-e9e8-4dc6-823c-94a06c04dbd0  /home                   xfs    defaults                      0  0
UUID=fa9eb208-82d5-4e72-9157-5f3dc253126d  /home/kasiazar/Thijs    ext4   defaults                      1  2
> 

Now I can see which of the disks I mounted with df -h and it is the one with one partition

/dev/sdd1 2048 7814035455 7814033408 3.7T Microsoft basic data

I am not sure why the type of that one is ‘Microsoft basic data’ or even what these types are. It was a disk used under Linux.
But the important thing is I can create new folders, files, move them around - it seems to work fine.

Any pointers, comments or links to read-up something are very appriciated.
Thanks!

Kasia

With all *NIX systems – UNIX®, Linux, Android, Mac OS – “everything is a file” …

  • A “normal” user only ever sees files – and directories – which are files anyway …

If you type, the CLI command “mount”, you’ll see that the mount points for the devices on your system.

If you inspect “/dev/disk/” you’ll notice a set of directories – don’t bother looking for /dev/ on a disk – it’s a run-time directory in the system’s memory – as well as some other system directories …


 > l /dev/disk/
total 0
drwxr-xr-x  7 root root  140 Oct 14 08:39 ./
drwxr-xr-x 20 root root 4660 Oct 14 08:40 ../
drwxr-xr-x  2 root root 1260 Oct 14 08:39 by-id/
drwxr-xr-x  2 root root  140 Oct 14 08:39 by-label/
drwxr-xr-x  2 root root  200 Oct 14 08:39 by-partuuid/
drwxr-xr-x  2 root root  560 Oct 14 08:39 by-path/
drwxr-xr-x  2 root root  200 Oct 14 08:39 by-uuid/
 > 

In the “by-uuid” directory, you’ll see some UUID values which are symbolic links to the partitions on the physical drives – /dev/sdax, /dev/sdbx, /dev/sdcx, /dev/sddx.
[HR][/HR]So, for a beginner, the most reliable method is, to use the System Administration tool “YaST” and, to select the System tool “Partitioner”.

Maybe reading this helps you in understanding how Unix/Linux works with mass-storage:
https://en.opensuse.org/SDB%3ABasics_of_partitions,_filesystems,_mount_points

Hej!

Thanks guys! I did not notice email notifications were now switched off.

It is actually super helpfult to look at the /dev/disk/ to understand some more. Thanks!
So the /dev/sd[abcd] are the original mounting points meaning the actual files representing the disks? Not sure if that is called a mounting point, maybe that name is just for the places that point to the actual files/folders making it look like they are there.
So all other names are links to that original place? and UUID is like one of the systems to refer to them? Is that a good approximation to understand this?

So I was just wondering WHO and WHEN gives this UUID to a partition? Does that mean I must have done that during the installation?
I am not sure what is the differences between by-uuid that currently only has the mounted partitiones (by mounted I mean the ones with a friendly name like /home etc)

> l /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 120 Oct  8 17:40 ./
drwxr-xr-x 7 root root 140 Oct  8 17:40 ../
lrwxrwxrwx 1 root root  10 Oct  8 17:40 7cb193c3-d707-4426-9297-086f85b4edfb -> ../../sda1
lrwxrwxrwx 1 root root  10 Oct  8 17:40 bb672245-e9e8-4dc6-823c-94a06c04dbd0 -> ../../sda3
lrwxrwxrwx 1 root root  10 Oct  8 17:40 dcdc1772-2bfa-4a91-a066-bf8b0d40017d -> ../../sda2
lrwxrwxrwx 1 root root  10 Oct  8 17:40 fa9eb208-82d5-4e72-9157-5f3dc253126d -> ../../sdd1
kasiazar@molev-32-13:~> 

and by-partuuid which has all partitions, including the ones I would like to mount under a friendly name

> l /dev/disk/by-partuuid/
total 0
drwxr-xr-x 2 root root 220 Oct  8 17:40 ./
drwxr-xr-x 7 root root 140 Oct  8 17:40 ../
lrwxrwxrwx 1 root root  10 Oct  8 17:40 000d6c8c-01 -> ../../sda1
lrwxrwxrwx 1 root root  10 Oct  8 17:40 000d6c8c-02 -> ../../sda2
lrwxrwxrwx 1 root root  10 Oct  8 17:40 000d6c8c-03 -> ../../sda3
lrwxrwxrwx 1 root root  10 Oct  8 17:40 4412c224-9736-43c3-af7a-6e5bb6bcb0cd -> ../../sdb1
lrwxrwxrwx 1 root root  10 Oct  8 17:40 6300bbbb-bfed-4ade-b9a1-de4a03eefb62 -> ../../sdb3
lrwxrwxrwx 1 root root  10 Oct  8 17:40 6e3392d0-2561-4a0b-8551-c916db924f98 -> ../../sdd1
lrwxrwxrwx 1 root root  10 Oct  8 17:40 89a4f5b4-9219-4dc4-b276-782693f39855 -> ../../sdb2
lrwxrwxrwx 1 root root  10 Oct  8 17:40 89f77676-c348-4bb6-92e1-c79ea43c1643 -> ../../sdc1
lrwxrwxrwx 1 root root  10 Oct  8 17:40 cebd54e7-cb5c-4d18-a013-5dabed931fae -> ../../sdc2

Not sure if I can just add lines to the /etc/fstab as soon as I figure out the file systems there - or maybe I decide that at this point…?
and then follow the same process with creating the file for the mount point and mounting it.

I did read this general mounting page and the idea of partition. Perhaps not much stays since I don’t exactly understand it yet. I need to use it more.
I will look for description of what is in /dev/disk. I am not sure if Yast Partitioner can help me much at this point, I see the same disks and partitions.
Not very obvious to me what could I do there but I will read your link more carefully. I dont think I just edit those partitions to add amount point like /data and that is it…? Is that the equivalent of adding lines to /etc/fstab and doing ‘mount’ after creating the mount files?

Maybe those texts contain all the answers, I just dont see it.

cheers,
Kasia

Please note the difference between “containers” (or “volumes”) and what is in them.

Partitions are one of the many forms of containers.

File systems are one of the many forms of contents.

Thus a partition can contain a file system (it can e.g. also contain swap space).

Disk partitions are, as the name says) parts of disks. They are created by putting a table (partition table) at the beginning of the disk. It is basically a list of start and end addresses on the disk where a partition starts and ends. Also, in GPT partitioning, each partition gets a Partition UUID. It is created by the partitioner on creation of a partition.

When you decide to use a partition for a file system, a file system is created on the partition (mostly by the same program that is used for partitioning), and most (for your day-to-day usage: all) file sytem types also have a UUID. Thus this is a second one! Mind the difference. BTW these latter are by default used by openSUSE on several places (like /etc/fstab and the kernel parameters in the boot menu).

What you see in /dev, is what the kernel found during boot (and also later when the situation changes) and reported to udevd. udevd then creates those file in /dev. They are called “device special files”, or shorter “device files”. (thus they are NOT mount points as you seem to think somewhere above).
These device files are a basic concept of Unix/Linux. They allow to see those devices as files. That is you can write and read directly from them. Now that is of course dangerous, thus you will see that they have set owner/permissions to protect them from usage by others then root. BTW it is one of the reasons that using root can break your system beyond repair!