LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2014, 12:53 PM   #1
kathbeau
Member
 
Registered: Nov 2014
Posts: 31

Rep: Reputation: Disabled
Confused how to mount, read/write external hard drive from terminal


Old Windows user, new to Linux, trying to backup my laptop for the first time.

uname -a
Linux mix 3.16-0.bpo.2-amd64 #1 SMP Debian 3.16.3-2-bpo70+1 (2014-09-21) x86_64 GNU/Linux

I plugged in a new Seagate external hard drive to USB 3.0. This showed up in the Dolphin file manager, and I could view the files/folders in the root of the device.

Opened a terminal and ran (as root) fdisk -l which shows:


Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907026943 1953512448 7 HPFS/NTFS/exFAT



I am trying to be able to access the drive from terminal. I was trying to do what I can do on Windows, that is, to "switch" to the backup drive for read/write operations. Windows creates an alias, e.g. "F:", for the device. When I couldn't get anywhere with syntax like

root@mix:~#/dev/sdb1
bash: /dev/sdb1: Permission denied

... I made the (perhaps flawed) assumption that the device needs to be mounted for terminal.

Typed mount /dev/sdb1 /mnt/, but error message:
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.

Ran fuser /mnt reported
/mnt: 8955c

I don't know what that means.

Thinking the "other software" that is using it might be Dolphin, and in a moment of madness, I ran umount /dev/sdb1. That command worked... no feedback in terminal, but the device disappeared from Dolphin. (Side issue: How do I get it to appear in Dolphin again? I tried unplugging it and plugging it back in, but Dolphin still cannot see it.)

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

Based on the information from fdisk, I tried HPFS, NTFS... both end in failure messages.

I'm just making things worse. Please help me before I accidentally do something irreversible*.

Thanks.
Kathleen

* Last week, while configuring my brand-new laptop that came with Debian Wheezy pre-installed for me, I misunderstood the meaning of apt-get dist-upgrade, ran it, and turned my stable OS into an unstable one. Had to go back to the vendor who kindly reinstalled the stable OS. I would really rather not keep having to learn things this hard way.
 
Old 11-10-2014, 01:20 PM   #2
littlejoe5
Member
 
Registered: Aug 2006
Location: Arizona
Distribution: Various Debian derivitives
Posts: 239

Rep: Reputation: 19
Sounds like you're mixing Windows and Linux. If your linux is Debian, or in the Debian derivatives 'family' (Ubuntu,Mint,Debian, etc.), In order to access a disk drive that is formatted to The most current Windows format, You need to install ntfs-3g

From Linux Terminal (command line) run this command:
apt-get install ntfs-3g

That should install the needed file, or if it's already installed, it will tell you.
Plug in your external drive, and it should show up in Dolphin ready to use.
 
Old 11-10-2014, 01:31 PM   #3
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by kathbeau View Post
Old Windows user, new to Linux
probably a very frequent configuration. ;-)
Yea, switching from one system to another isn't always a sunday afternoon walk.

Quote:
Originally Posted by kathbeau View Post
I plugged in a new Seagate external hard drive to USB 3.0. This showed up in the Dolphin file manager, and I could view the files/folders in the root of the device.
The typical behavior of GUI file managers.

Quote:
Originally Posted by kathbeau View Post
I am trying to be able to access the drive from terminal. I was trying to do what I can do on Windows, that is, to "switch" to the backup drive for read/write operations. Windows creates an alias, e.g. "F:", for the device.
As you may know, Linux only maintains _one_ directory structure. All media are "mounted" and then appear as a directory somewhere.

Quote:
Originally Posted by kathbeau View Post
I made the (perhaps flawed) assumption that the device needs to be mounted for terminal.
The assumption is perfectly right - the drive has to be mounted for use from anywhere, not only for access from a terminal. I suppose you're missing the point that the drive is auto-mounted when it's plugged in. Most distros are configured to do that. So I assume that you'll find a directory below /media that represents your external drive. Try this:

Code:
ls -la /media
I'd expect you'll see something roughly like this:

Code:
me@home /data: ls -la /media
total 24
drwxrwxrwx  3 root root  4096 2014-11-10 19:21 .
drwxr-xr-x 24 root root  4096 2013-01-24 17:03 ..
drwx------ 34 me   me   16384 1970-01-01 01:00 78F1-0D6A
The "78F1-0D6A" could be anything else in your system, possibly a clear-text label if your external drive comes preconfigured to hav a label, otherwise just an identifier consisting of hex number, like the example. Now you can 'cd' into that directory and access the contents of your external drive.

Quote:
Originally Posted by kathbeau View Post
* Last week, while configuring my brand-new laptop that came with Debian Wheezy pre-installed for me, I misunderstood the meaning of apt-get dist-upgrade, ran it, and turned my stable OS into an unstable one. Had to go back to the vendor who kindly reinstalled the stable OS. I would really rather not keep having to learn things this hard way.
It sounds cruel, but sometimes you have to learn it the hard way. :-(

[X] Doc CPU
 
Old 11-10-2014, 02:06 PM   #4
kathbeau
Member
 
Registered: Nov 2014
Posts: 31

Original Poster
Rep: Reputation: Disabled
To littlejoe5:
  • apt-get install ntfs-3g reports that this is already installed
  • unplugged/replugged device to USB 3, still no display in GUI

To Doc CPU:
I have restarted my laptop (sheesh, Windows users, eh?), but GUI still does not acknowledge external drive.
Plugged into a different USB port; still nothing.

Looked in the System Settings for Removable Devices, and noted that the checkmark for Enable automatic mounting of removable media was not there. (Did I do that from that single umount command?) Put the checkmark back, saved the setting. Again, unplugged/replugged device,still nothing.

Ran ls -la /media; here's what I get:

Code:
root@mix:~# ls -la /media
total 12
drwxr-xr-x  3 root root 4096 Nov 10 08:45 .
drwxr-xr-x 26 root root 4096 Nov  5 10:53 ..
lrwxrwxrwx  1 root root    6 Nov  4 15:21 cdrom -> cdrom0
drwxr-xr-x  2 root root 4096 Nov  4 15:21 cdrom0
I don't see anything suggesting the external drive.

But fdisk still "sees" it... actually, this is a longer listing than I recall from before:

Code:
root@mix:~# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000872fe

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     9785343     4891648   82  Linux swap / Solaris
/dev/sda2   *     9785344   976771071   483492864   83  Linux

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3907026943  1953512448    7  HPFS/NTFS/exFAT
Quote:
It sounds cruel, but sometimes you have to learn it the hard way. :-(
Gee, I hope you don't mean that for something as commonplace as trying to access an external hard drive!

Thanks for your help with this, both of you.
Kathleen
 
Old 11-10-2014, 02:18 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,983

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
I don't use Debian so I don't know if it auto-mounts external drives under /media, many Linux systems do. The command below run as root should mount it:

Code:
mount -t ntfs /dev/sdb1 /mnt
The filesystem type, in this case ntfs, needs to be lower case. Don't know if you did that? If the above doesn't work, you have other problems.
 
Old 11-10-2014, 02:34 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,603
Blog Entries: 25

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Member response

Hi,

Welcome to LQ!
Be aware that you can always use 'man command' (without ticks) to get understanding for a particular command (note that ~# is my root prompt);
Quote:
~# man fdisk;
NAME
fdisk - manipulate disk partition table

SYNOPSIS
fdisk [-uc] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

fdisk -l [-u] [device...]

fdisk -s partition...

fdisk -v

fdisk -h

DESCRIPTION
fdisk (in the first form of invocation) is a menu-driven program for creation and manipulation of partition tables. It understands DOS-type partition tables and BSD- or SUN-
type disklabels.

fdisk does not understand GUID partition tables (GPTs) and it is not designed for large partitions. In these cases, use the more advanced GNU parted(8).

fdisk does not use DOS-compatible mode and cylinders as display units by default. The old deprecated DOS behavior can be enabled with the '-c=dos -u=cylinders' command-line
options.

Hard disks can be divided into one or more logical disks called partitions. This division is recorded in the partition table, found in sector 0 of the disk. (In the BSD
world one talks about `disk slices' and a `disklabel'.)
From your 'fdisk -l' you show the external device as '/dev/sdb1'. I suggest as root you create a mount point in '/mnt' by opening a terminal and at prompt issue 'su -' then password to perform;
Code:
~# mkdir /mnt/your_mount_point
This will create the new mount point '/mnt/your_mount_point'. You would then do;
Code:
~# mount /dev/sdb1 /mnt/your_mount_point
Once mounted you can then do a change directory;
Code:
~# cd /mnt/your_mount_point
From there you can perform anything allowed at that mount point for the current user which is 'root' if you use 'su -' to get root within a terminal.

I like to provide to new user;
Quote:
Just a few links to aid you to gaining some understanding;



1
Linux Documentation Project
2
Rute Tutorial & Exposition
3
Linux Command Guide
4
Bash Beginners Guide
5
Bash Reference Manual
6
Advanced Bash-Scripting Guide
7
Linux Newbie Admin Guide
8
LinuxSelfHelp
9
Utimate Linux Newbie Guide

The above links and others can be found at '
Slackware-Links'. More than just SlackwareŽ links!

Be sure to look at my signature below for more helpful links.
Have fun!
Hope this helps.
 
Old 11-10-2014, 02:40 PM   #7
kathbeau
Member
 
Registered: Nov 2014
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
I don't use Debian so I don't know if it auto-mounts external drives under /media, many Linux systems do. The command below run as root should mount it:

Code:
mount -t ntfs /dev/sdb1 /mnt
The filesystem type, in this case ntfs, needs to be lower case. Don't know if you did that? If the above doesn't work, you have other problems.
Maybe I do have other problems...
Code:
root@mix:~# mount -t ntfs /dev/sdb1 /mnt
NTFS signature is missing.
Failed to mount '/dev/sdb1': Invalid argument
The device '/dev/sdb1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
I think we're onto something... I plugged the device into my Windows laptop, and it says "You need to format the disk in drive D: before you can use it."

I tried this simply because the device comes with software that installs on Windows, and I assumed I could pass it between the two machines (I have done that with a thumb drive, no problems).

So I reformatted it under Windows. Plugged it back into my Linux USB port, and the autoloader popped up. Using Dolphin, I can read/write the device.

Now the command Doc CPU recommended yields this:

Code:
root@mix:~# ls -la /media
total 16
drwxr-xr-x  4 root     root     4096 Nov 10 11:30 .
drwxr-xr-x 26 root     root     4096 Nov  5 10:53 ..
lrwxrwxrwx  1 root     root        6 Nov  4 15:21 cdrom -> cdrom0
drwxr-xr-x  2 root     root     4096 Nov  4 15:21 cdrom0
drwx------  1 kathleen kathleen 4096 Nov 10 11:34 mixbak
And now, putting it altogether I THINK I GET IT!!

By navigating to /media/{my device}, I can read/write it from the terminal.

THANK YOU ALL SO MUCH!!
Kathleen
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] External USB hard drives no longer mounting read/write -- now read only revbish Puppy 2 01-28-2013 06:44 PM
How to mount an external ntfs drive with full read/write permissions for everyone Da9L Linux - Newbie 10 12-03-2012 06:54 AM
Trying to mount an external UBS drive with ntfs as read/write Sanford Stein Linux - Newbie 7 08-27-2008 10:04 AM
Can't Write to External Hard Drive Sloppyunderfoot Linux - Hardware 2 08-18-2007 11:05 PM
External hard-drive - readonly, can't make it read/write mooseman Linux - Hardware 3 05-18-2007 03:27 AM


All times are GMT -5. The time now is 05:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration