3

Running sudo fdisk -lu returns the hdd I want to mount as

Disk /dev/sdb

but when I try to mount it from KDE Partition Manager it doesn't show some directories when I try to set up a path (tried showing hidden folders, only displayed 3) and through the konsole with sudo mount /dev/sdb /mnt, I get

mount: wrong fs type, bad option, bad superblock on /dev/sdb,
   missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.

so I tried running sudo e2fsck -f -b 32768 -y /dev/sdb and get

e2fsck 1.42.13 (17-May-2015)
e2fsck: Bad magic number in super-block while trying to open /dev/sdb

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

and when I try those variations I get the same message. How do I mount this hard drive? The file type for the hdd is "inode/blockdevice" and I've already created a partition for it but it won't save without a path.

Also, why does it say 17-May-2015?

Many thanks.

enter image description here

EDIT: Was able to find the /dev folder by clicking the bar next to "Look in" however the partitions don't show up even as hidden files but it does show up if I type it into the "Directory:" bar but its not selectable ("Choose" is greyed).

enter image description here

Gparted, as expected, no difference. I'm sure its a file type error..

enter image description here

Re-partition the hard drive in gparted:

enter image description here

and after applying the settings it seems to have worked but upon opening my file manager, the "Devices" listing on the leftside has disappeared! My ssd is not even listed (as it had been before) "Devices" title is not there!

HelpMeee
  • 648
  • 3
  • 10
  • 20
  • 3
    Usually you mount by the partition number on the drive. It should be `sudo mount /dev/sdb1 /mnt` meaning to mount the first partition to `/mnt` if that is what you're trying to mount. – Terrance Jul 20 '16 at 03:29
  • Its in /dev/ as just "sdb". Oh, I just want it under "Devices" in the file manager (under my SSD) – HelpMeee Jul 20 '16 at 03:52
  • 3
    It needs a partition that's formatted to mount. Those show up as `/dev/sda1` or `/dev/sdb1` etc... – Terrance Jul 20 '16 at 03:58
  • Do you know how I would do that through KDE Partition Manager? I've uploaded a picture. Its telling me to create a new partition table; does it need to have at least four? I'm only using it for storage. – HelpMeee Jul 20 '16 at 04:11
  • Nevermind, its no longer asking me to create a partition table once I clicked "Apply", but the sudo command line to mount still gives the same error. – HelpMeee Jul 20 '16 at 04:20
  • 1
    I haven't used the KDE Partition Manager, but I do use `gparted`. To install it, `sudo apt install gparted`, then you need to run it with elevated permissions, `sudo gparted`. That will allow you to create your new partition to the drive. You only need one partition for storage. What you format it to will depend on how you're going to use it. Cross platform is probably best at NTFS so Windows can read it too. – Terrance Jul 20 '16 at 04:20
  • Are there any downsides to NTFS in comparison to the other available options? (Most likely only sticking with Linux) – HelpMeee Jul 20 '16 at 04:22
  • 1
    I used NTFS on all my shared drives as it is compatible with Windows and doesn't suffer from 4GB file size limitation. – Terrance Jul 20 '16 at 04:23
  • If you're only sticking with Linux, ext3 or ext4 are great to use. – Terrance Jul 20 '16 at 04:24
  • ok, added a picture from gparted and not sure how to format the partition to mount. – HelpMeee Jul 20 '16 at 04:37
  • I mounted the hard drive! Thanks, guessing KDE Partition manager was at fault. Now I'm having another issue which I will submit as another question. Could you submit an answer instead of a comment so I can mark this question answered? Thank you! – HelpMeee Jul 20 '16 at 04:55
  • 1
    You somehow mounted your new drive as the root, which is not what you need. Reboot your computer, and you need to change the mount of that drive to something other than `/`. You can name it like `/data` – Terrance Jul 20 '16 at 04:56
  • I'll write something up as an answer for you. – Terrance Jul 20 '16 at 04:57
  • I originally mounted it to `mnt` then changed it to `/` because I wanted it beneath the ssd in the device list in the file manager, my mistake. I'm guessing I'll have to change the mount point through the BIOS? – HelpMeee Jul 20 '16 at 04:58
  • But you need to reboot your system now – Terrance Jul 20 '16 at 04:59
  • alright, I rebooted and its listed under devices now! :D Is there really a problem with it being mounted under root? – HelpMeee Jul 20 '16 at 05:07
  • Your OS is mounted as `/` so we need to mount it to another location. I am writing up an answer right now for you. – Terrance Jul 20 '16 at 05:07
  • I haven't noticed any conflict but alright. I'm trying to start gparted again and it just asks me for my password then.. closes (like it was a tab at the bottom panel but it doesn't stay longer than two seconds). When I run `sudo gparted` it tells me its already running. – HelpMeee Jul 20 '16 at 05:10
  • 1
    I answered it for you. You may not need to reformat it right now, only just apply it to a new mount point that I put in my answer for you. – Terrance Jul 20 '16 at 05:15

2 Answers2

5

/dev/sdb is the entire block device, you don't mount this.
You mount a partion that is on the device, example:

sudo mount /dev/sdb1 /mnt 

From the first image, it looks as if there are no partitions on the disk any way, or you have recently made some changes to the partiton table and the kernel is not aware of them, so it is best to run

sudo partprobe

after making changes to inform the kernel to take a look at the new partion table.
No need to reboot, just run partprobe.

You mount the partitions on the disk to a mount point somewhere on the root filesystem (/).
Don't mount the disk directly to / , i.e. don't do the below as you'll be mounting over you root filesystem.

sudo mount /dev/sdb1 / #wrong

Typically, you mount to /mnt or /media or a subdirectory within those for temporary mounting; or by creating a dedicated mount point for that device, /data/ is common.

sudo mkdir /data
sudo mount /dev/sdb1 /data

Also, why does it say 17-May-2015?
That is the release date for that version of e2fsck.

  • Earlier I saved over root, what are the concerns for that? Thanks for your helpful input! The first code you gave was an essential part of fixing my problem! – HelpMeee Jul 20 '16 at 05:56
2

New hard drives need to have a new partition created on them so that they can be used. I recommend using gparted. To install the program, type in the following from a terminal window:

sudo apt install gparted

Then gparted needs to be ran with elevated permissions:

sudo gparted

After your drive is configured, now you need to mount it somewhere. If you want it accessible, you need to create a mount point on your computer for it first. From the terminal window type in the following to create the mount point:

sudo mkdir -p /media/datadrive

we are just going to use datadrive as the example for the mount point.

Next, we need to get the UUID of the drive so we can make the mount come up the same every boot.

sudo blkid

Here is an example:

terrance@terrance-ubuntu:~$ sudo blkid
/dev/sde1: UUID="9e4539a5-7229-424e-aa91-60ab1417e6f1" TYPE="ext4" PARTUUID="00090c7c-01"

Using the UUID number from the above example, now we are going to add it to the /etc/fstab file. Use your favorite editor, and add the following line to the /etc/fstab file. Note: This file is owned by root, so it needs to be edited with elevated permissions.

sudo nano /etc/fstab

Then add to the bottom:

UUID=9e4539a5-7229-424e-aa91-60ab1417e6f1 /media/datadrive ext4 defaults 0 0

You can now activate the mount by typing in the following with no reboot required:

sudo mount -a

Now on every reboot the new drive will mount to the /media/datadrive mount point every time.

Hope this helps!

Terrance
  • 39,774
  • 7
  • 116
  • 176
  • putting `gksu gedit /etc/fstab` into the terminal with no return s: Anyway, I added my hdd's uuid in the same format you lined out (using the terminal) and I'm unsure of how to save the changes. Sorry for the inexperience. – HelpMeee Jul 20 '16 at 05:28
  • 1
    @HelpMeee You apply the changes by choosing File and Save, or just exit and it will prompt you to save. If you're using `nano` it is Ctrl+O to write the changes, and then Ctrl+X to exit. Then you can do the `sudo mount -a` – Terrance Jul 20 '16 at 05:30
  • `mount: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.` after doing `sudo mount -a` – HelpMeee Jul 20 '16 at 05:49
  • @HelpMeee What did you format your partition to? And secondly, what line did you add? – Terrance Jul 20 '16 at 05:50
  • Oh, I just did `sudo mount /dev/sdb1 /data` and it looks like that solved that (mounted it elsewhere though, so I have to change the fstab file to match) the partition is ext4 as you put, and I added the exact same line to the fstab file except with my UUID – HelpMeee Jul 20 '16 at 05:52
  • @HelpMeee Yeah, just change your fstab to match then. – Terrance Jul 20 '16 at 05:53
  • Note that the fstab option should be `defaults`, with an `s`. Without the `s` it results in the error from the comment above. – Marijn Jun 11 '21 at 12:09
  • @Marijn Good catch! Edited – Terrance Jun 11 '21 at 12:48