LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trying to mount a usb disk to a folder (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-mount-a-usb-disk-to-a-folder-4175589631/)

MarianH 09-17-2016 03:56 PM

Trying to mount a usb disk to a folder
 
Dear all,

I would like to ask you for help how to mount an external USB drive to a folder properly. I am a complete Linux noob, so everything written below is from various discussions I've found on the internet.
I have an external usb disk where I have data (hope they are still there). If I try to mount it to a folder it says mount: wrong fs type, bad option, bad superblock on /dev/sdb1, ...doing e2fsck it says superblock cannot be read or does not describe a valid ....so I did e2fsck -b 32768 and still the same error.

I am already desperate ... I really would like to save the data (or at least as big part as possible) on that drive, however I have no idea what should I do.

I've read I should do a backup of the drive before doing any "experiments", however after doing some googling I think (still not 100% sure) the "new disk" has to be bigger than the "original" 2TB HDD. Unfortunately I don't have bigger one and currently have no possibility to borrow one, therefore I have to risk that by trying to make it work, I'll loose the data.

Any suggestions please?

Thank you.

HMW 09-19-2016 09:26 AM

What is the (exact) command you are using when you try to mount the device?

michaelk 09-19-2016 09:35 AM

In addition,
What linux distribution/version are you running? Typically most external drives are formatted as NTFS by the manufacture so running linux utilities is not recommended.

Most mainstream distributions install ntfs-3g by default and depending on the desktop will automatically mount external drives.

Does this drive still work with windows?

MarianH 09-19-2016 11:43 AM

Quote:

Originally Posted by michaelk (Post 5607283)
In addition,
What linux distribution/version are you running? Typically most external drives are formatted as NTFS by the manufacture so running linux utilities is not recommended.

Most mainstream distributions install ntfs-3g by default and depending on the desktop will automatically mount external drives.

Does this drive still work with windows?

Hello,

well, to explain you the situation a bit more. I've had this USB disk connected to Ubuntu - Zentyal. This was mounted automatically by the system start.
Then the USB HDD was disconnected (the thing is I am not sure if properly) and now it is connected to CentOS6 - Nethserver. I was trying to mount it to Nethserver. As this was not working, I've returned back Ubuntu (I have two HDDs which I can take out of the machine and one holds Ubuntu and second Nethserver, so I can change these anytime), however it was working neither.
The USB HDD was always connected to Linux, never to Win.
And now the command. I have a folder in root called Share. So I did
mount -t vfat /dev/sdb1 /share/

jefro 09-19-2016 04:27 PM

Hello and welcome to LQ.

Stop what you doing first of all. Let us sort this out.
Making changes may not make it easier.


I think you did something along these lines?
https://linuxexpresso.wordpress.com/...ock-in-ubuntu/

MarianH 09-19-2016 04:43 PM

Quote:

Originally Posted by jefro (Post 5607435)
Hello and welcome to LQ.

Stop what you doing first of all. Let us sort this out.
Making changes may not make it easier.


I think you did something along these lines?
https://linuxexpresso.wordpress.com/...ock-in-ubuntu/

Hello,

yes, that's exactly what I did as you can see in my first post. And it didn't work unfortunately :-(

michaelk 09-19-2016 05:11 PM

How is the formated?
Do you normally use in windows?

teckk 09-19-2016 05:13 PM

lsblk for dev node, then check what file system it has on it.
Code:

# fdisk -l /dev/sdb
Disk /dev/sdb: 986 MiB, 1033895936 bytes, 2019328 sectors
........

Device    Boot Start    End Sectors  Size Id Type
/dev/sdb1          64 2019327 2019264  986M  6 FAT16

or
Code:

# parted -l /dev/sdb
.........
Number  Start  End    Size    Type    File system  Flags
 1      32.8kB  1034MB  1034MB  primary  fat16

then:
Code:

# mount -t vfat /dev/sdb1 ~/usb
or if ntfs
Code:

# parted -l
.........
Number  Start  End    Size    File system  Flags
 1      0.00B  15.5GB  15.5GB  ntfs

then
Code:

# ntfs-3g /dev/sdb1 ~/usb
Also ntfsfix and friends came with ntfsprogs, now the come with ntfs-3g

I've used it before on ntfs volumes and it worked ok to repair it.

BW-userx 09-19-2016 07:25 PM

mounting a USB HDD is a bit silly, to me, not that it cannot be done. when all one has to do is plug in it ,then open a filemanager then click on that drive as it should be getting auto mounted, the clicking onto that drive within the filemanager is to finalize the connection to the drive.

if one is to mount it during boot up in fstab (correct me if I am wrong) but if it is not present during booting you're going to get a boot error leaving not being able to fully boot into your system, until you correct the problem.


Code:

sudo blkid (to get the mount point]
sudo mount /dev/sdx /mnt

done

for fk disk if it is a windows format did you try using windows to scan and repair it?

MarianH 09-20-2016 12:06 PM

Hello,

thank you for all your posts. This is what I get.

fdisk -l /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 2000.4 GB, 2000398933504 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002edd1

Device Boot Start End Blocks Id System
/dev/sdb1 1 243202 1953514583 ee GPT



sudo blkid
/dev/sda1: UUID="2112ba5b-ab3c-4f83-986d-82dc8fde5de9" TYPE="ext3"
/dev/sda2: UUID="1v3xAT-zsVn-kEim-3wfT-7aEC-NwxY-1nR0Ut" TYPE="LVM2_member"
/dev/mapper/VolGroup-lv_swap: UUID="09acb377-c813-46ae-acaf-c388e044a963" TYPE="swap"
/dev/mapper/VolGroup-lv_root: UUID="098274fc-3eee-4000-b80c-f4327b288fb4" TYPE="ext4"


sudo mount /dev/sdb1 /mnt
mount: you must specify the filesystem type


Does that mean he doesn't see the sdb1?

BW-userx 09-20-2016 07:56 PM

check the filesystem type using the file command:
Code:

sudo file -sL /dev/sdx

 mount /dev/sdx /destination -t fileSystemType

as far as this
Quote:

sudo blkid
/dev/sda1: UUID="2112ba5b-ab3c-4f83-986d-82dc8fde5de9" TYPE="ext3"
/dev/sda2: UUID="1v3xAT-zsVn-kEim-3wfT-7aEC-NwxY-1nR0Ut" TYPE="LVM2_member"
/dev/mapper/VolGroup-lv_swap: UUID="09acb377-c813-46ae-acaf-c388e044a963" TYPE="swap"
/dev/mapper/VolGroup-lv_root: UUID="098274fc-3eee-4000-b80c-f4327b288fb4" TYPE="ext4"

---
sudo mount /dev/sdb1 /mnt
mount: you must specify the filesystem type


Does that mean he doesn't see the sdb1?
it is not showing up in bkid, so you just ball parked it ??

MarianH 09-21-2016 12:53 AM

Quote:

Originally Posted by BW-userx (Post 5607993)
check the filesystem type using the file command:
Code:

sudo file -sL /dev/sdx

 mount /dev/sdx /destination -t fileSystemType

it is not showing up in bkid, so you just ball parked it ??

It shows this:
[root@server ~]# sudo file -sL /dev/sdb
/dev/sdb: x86 boot sector; partition 1: ID=0xee, starthead 0, startsector 1, 3907029166 sectors, code offset 0xb8

[root@server ~]# sudo file -sL /dev/sdb1
/dev/sdb1: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 128, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 63, dos < 4.0 BootSector (0x80)


Sorry, I don't understand your comment below. Could you please write it as for dummies :-D (I am linux noob)

Quote:

Originally Posted by BW-userx (Post 5607993)
it is not showing up in bkid, so you just ball parked it ??


BW-userx 09-21-2016 07:53 AM

:study:
Quote:

Originally Posted by MarianH (Post 5608075)
It shows this:
[root@server ~]# sudo file -sL /dev/sdb
/dev/sdb: x86 boot sector; partition 1: ID=0xee, starthead 0, startsector 1, 3907029166 sectors, code offset 0xb8

[root@server ~]# sudo file -sL /dev/sdb1
/dev/sdb1: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 128, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 63, dos < 4.0 BootSector (0x80)


Sorry, I don't understand your comment below. Could you please write it as for dummies :-D (I am linux noob)

when you do sudo blkid it will show everything (hdd) connected to your system. I didn't see /dev/sdb1 in that listings you posted. So I inquired how you came about using /dev/sdb1.

ie.
Code:

userx@voided & ~ >> $sudo blkid
/dev/sda1: LABEL="System Reserved" UUID="16BE1703BE16DAD7" TYPE="ntfs" PARTUUID="0004ed67-01"
/dev/sda2: UUID="6602CF6F02CF42B3" TYPE="ntfs" PARTUUID="0004ed67-02"
/dev/sda3: UUID="ee8bca61-3837-47e3-8601-77e0ba20f446" TYPE="ext4" PARTUUID="0004ed67-03"
/dev/sda4: UUID="2cbaed98-039f-45d4-bf0d-4eb200009ec4" TYPE="ext4" PARTUUID="0004ed67-04"
/dev/sdb1: UUID="db09f385-7bce-4640-9159-84d9fd89ff06" TYPE="ext4" PARTUUID="0f3f3740-01"
/dev/sdb2: LABEL="ssd2" UUID="0f18d5ee-14a6-4f0b-9d88-37b3140ed748" TYPE="ext4" PARTUUID="0f3f3740-02"
/dev/sdc1: LABEL="WD3TB" UUID="89f35fb4-9578-42ca-9244-0f4b5ef1604d" TYPE="ext4"
/dev/sdd1: LABEL="wd1tb" UUID="76D2-05BB" TYPE="vfat" PARTUUID="4d6d966b-01"
/dev/sde1: UUID="a06fed17-47a5-4ae9-85a1-416e4a4124a7" TYPE="ext4" PARTUUID="41c874ec-01"

your /dev/sdb1 is telling you it is NTFS. so you'll have to be sure that ntfs-3g is installed then use the -t ntfs-3g switch/argument when mounting it.

the difference between /dev/sdb and /dev/sdb1 . /dev/sdb is the entire device whereas /dev/sdb1 is a partition on said device. when using the dd program. This is one that you use the device name with. Most other operations like mounting and searching device you use the partition, and path to directory if wanted. I hope that helped give you a litte more insight.

Insight 2: when logged in as root you do not have to use the sudo command, that is being redundant

MarianH 09-21-2016 08:29 AM

Quote:

Originally Posted by BW-userx (Post 5608195)
:study:

when you do sudo blkid it will show everything (hdd) connected to your system. I didn't see /dev/sdb1 in that listings you posted. So I inquired how you came about using /dev/sdb1.

ie.
Code:

userx@voided & ~ >> $sudo blkid
/dev/sda1: LABEL="System Reserved" UUID="16BE1703BE16DAD7" TYPE="ntfs" PARTUUID="0004ed67-01"
/dev/sda2: UUID="6602CF6F02CF42B3" TYPE="ntfs" PARTUUID="0004ed67-02"
/dev/sda3: UUID="ee8bca61-3837-47e3-8601-77e0ba20f446" TYPE="ext4" PARTUUID="0004ed67-03"
/dev/sda4: UUID="2cbaed98-039f-45d4-bf0d-4eb200009ec4" TYPE="ext4" PARTUUID="0004ed67-04"
/dev/sdb1: UUID="db09f385-7bce-4640-9159-84d9fd89ff06" TYPE="ext4" PARTUUID="0f3f3740-01"
/dev/sdb2: LABEL="ssd2" UUID="0f18d5ee-14a6-4f0b-9d88-37b3140ed748" TYPE="ext4" PARTUUID="0f3f3740-02"
/dev/sdc1: LABEL="WD3TB" UUID="89f35fb4-9578-42ca-9244-0f4b5ef1604d" TYPE="ext4"
/dev/sdd1: LABEL="wd1tb" UUID="76D2-05BB" TYPE="vfat" PARTUUID="4d6d966b-01"
/dev/sde1: UUID="a06fed17-47a5-4ae9-85a1-416e4a4124a7" TYPE="ext4" PARTUUID="41c874ec-01"

your /dev/sdb1 is telling you it is NTFS. so you'll have to be sure that ntfs-3g is installed then use the -t ntfs-3g switch/argument when mounting it.

the difference between /dev/sdb and /dev/sdb1 . /dev/sdb is the entire device whereas /dev/sdb1 is a partition on said device. when using the dd program. This is one that you use the device name with. Most other operations like mounting and searching device you use the partition, and path to directory if wanted. I hope that helped give you a litte more insight.

Insight 2: when logged in as root you do not have to use the sudo command, that is being redundant

So when you say all drives should be listed (even USB HDD?), do you think it might be something wrong with the HDD? Because doing fdisk, it shows the drive (as mentioned in one of the previous posts)
sorry, what is ntfs-3g? something like add-in? should I install/download it? how?

michaelk 09-21-2016 08:36 AM

While Ubuntu installs NTFS support by default Redhat/CentOS does not. To install ntfs-3g in CentOS you need to enable the epel repository.

If the drive was not unmounted/ejected properly from Ubuntu then the filesystem might be corrupted. While ntfsfix can repair simple errors this might require chkdsk which requires a real windows computer.

Once you get this problem resolved you might want to switch to a linux filesystem if you never need to connect it to a Windows computer. This will require you to backup all the data somewhere since reformatting will essentially "erase" existing files.


All times are GMT -5. The time now is 02:20 PM.