Member Avatar for Member #808376

how do i mount a hardrive on Ubuntu via terminal?

Dani AI

Generated

A few clarifications and a concise workflow that fill gaps in the thread.

Partitions are numbered starting at 1 (so the first partition is typically /dev/sdb1, not sdb0). was right to look for the device name and ’s dmesg approach is useful for hot-plugged USB sticks; is also correct that many device tools need root privileges. The common error shown in the thread (“already mounted or /mnt busy”) usually means either the whole block device was targeted instead of a partition, or the mount point is already in use by another mount or process.

Quick, safe checklist (identify → check → mount):

  • List disks, partitions, filesystem types and current mount points:
    lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,LABEL
  • Show filesystem details (replace device as appropriate):
    blkid -o export /dev/sdb1
  • See whether the target directory is already a mount or in use:
    findmnt /mnt
    fuser -mv /mnt

If findmnt shows an existing mount, use a different empty directory as the mount point (create it if needed). If fuser lists PIDs, stop those processes before mounting. To mount a specific partition and force an explicit filesystem choice (safer than guessing), create a mount point and mount by device and fs type.

For persistent mounts prefer using the filesystem UUID in /etc/fstab so device name changes don’t break things. Example fstab entry (UUID is a placeholder):

UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  /media/data  ext4  defaults  0  2

Troubleshooting notes: if the kernel reports “unknown filesystem,” install the proper user-space driver for that filesystem (e.g., NTFS or exFAT support varies by distribution). Avoid forcing unmounts unless necessary; lazy or forced unmounts can hide data-loss risks.

Recommended Answers

All 6 Replies

First you have to find out what device name the system has given the new drive. Normally it is something like /dev/sda (which stands for scsi or sata drive a) or /dev/hda (pata drive a) and then it will be broken down by partitions. For example the second sata drive primary partition would be /dev/sdb0 .
You can check what partitions the system sees with

fdisk -l

and then mount the partition as a directory on the system. The /mnt directory is normally used for this and the contents or the drive replace what was previously visible in the directory (so don't mount anything to /home or /var or /etc OK). To mount the second PATA hard drive primary partition as /mnt you would use:

mount /dev/hdb0 /mnt

If you are not sure about the mount options use the man pages to get more info:

man mount

This may be of use - it normally works for me.

First plug in the USB device and check that it has been seen.

[shibblez@server mnt]$ dmesg
usb 1-5: new high speed USB device using address 12
scsi9 : SCSI emulation for USB Mass Storage devices
  Vendor: SanDisk   Model: Cruzer            Rev: 8.02
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi9, channel 0, id 0, lun 0
USB Mass Storage device found at 12
SCSI device sda: 7856127 512-byte hdwr sectors (4022 MB)
sda: Write Protect is off
sda: Mode Sense: 45 00 00 08
sda: assuming drive cache: write through
SCSI device sda: 7856127 512-byte hdwr sectors (4022 MB)
sda: Write Protect is off
sda: Mode Sense: 45 00 00 08
sda: assuming drive cache: write through
sda: sda1
[shibblez@server mnt]$

Now mount the device - note that it is /dev/sda1 and not /dev/sda. Ithen list its contents and unmount it.

[shibblez@server mnt]$ sudo mount /dev/sda1 usb00/
[shibblez@server mnt]$ ls usb00
Documents  LaunchU3.exe  System
[shibblez@server mnt]$ sudo umount usb00
[shibblez@server mnt]$ ls usb00
[shibblez@server mnt]$
Member Avatar for Member #808376

in order for fdisk -l to work you have to write sudo first...ie sudo fdisk -l

Member Avatar for Member #808376

after writing sudo mount /dev/sdb /mnt then i press enter gives me this message.

lnx@lnx:~$ sudo mount /dev/sdb /mnt
mount: /dev/sdb already mounted or /mnt busy
lnx@lnx:~$ sudo mount /dev/sdb /mnt

Ah I cheat and run
sudo su -
Opens a root shell with all of roots paths and variables.

I am always use the Ubuntu.. and this through get the speedway work out and very easy way to support...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.