In the gui, mode to mount a disk , I just click the name of the drive in the menu "place", and the disk gets mounted. However, can I mount that drive easily in the text mode (from terminal or command line) just using a command?
2 Answers
You can mount the drive from command line easily even without creating a folder in /media
as other question suggests.
- Open a terminal
- Type
udisks --mount /dev/sda2
The result?
Your /dev/sda2
will be mounted in the /media/label
, where label
refers to the name of label of the partition. For example, my /dev/sda2
is labeled as Main
, and when i do the command, "/dev/sda2" will be mounted on /media/Main
.
How do i know, My Drive "Drivename"'s sdaX
number ?
You can execute
sudo blkid
command in a terminal to know, which sdaX you have to input.Example: My example run returns this:
anwar@edubuntu-lenovo:~$ sudo blkid /dev/sda1: UUID="01CD4993623F05D0" TYPE="ntfs" /dev/sda2: LABEL="Main" UUID="A80C1BD70C1B9F7E" TYPE="ntfs" /dev/sda3: LABEL="Work" UUID="01CCB271A80A07E0" TYPE="ntfs" /dev/sda5: LABEL="Free" UUID="DE53-CB6B" TYPE="vfat" /dev/sda6: UUID="364126ac-01c9-4dd2-ab19-eecc733a9640" TYPE="ext4" /dev/sda7: UUID="b1537dfc-e918-4fea-9a99-44a034e57429" TYPE="swap" /dev/sda8: UUID="01CD49906DD38770" TYPE="ntfs" /dev/sda9: LABEL="Precise-New" UUID="7c934266-dfcb-45de-879b-e3ceafcd0862" TYPE="ext4"
So i know that, if I wanted to mount "Work", I have to use sda3
.
If the partition has no label:
If your partition has no label, it will be mounted in /media/UUID
, where UUID
refers to the UUID of the partition.
For example: If i mount my /dev/sda8
, which does not have a Label, it will be mounted in /media/01CD49906DD38770
Folder.
Hope this will help.
You have to create a dir (preferably in /media
), for example win
. You can do it with sudo mkdir /media/win
.
After that you can use the sudo ntfs-3g /dev/device /media/win
command. You have to replace the device with the correct device identifier (sdb2 for example means the second partition of the second storage device in your computer).
If everything went OK, /media/win
will contain that NTFS partition.
-
1One thing to note though, if this does not work, you can possibly replace the
sudo ntfs-3g /dev/device /media/win
command withsudo mount -t ntfs /dev/device /media/win
(replacingdevice
with the correct device identifier as is explained in Iradrian's post).– Thomas Ward ♦Mar 23, 2011 at 15:25 -
How to get the device id? Is there a command to do this?– user8260Mar 23, 2011 at 15:31
-
@Jinx, as I wrote down earlier, the devices get an automated name. If you are unsure which is your device, you can run the
sudo fdisk -l /dev/sda
command for example, so you can filter whether it has your NTFS partition or not.– IradrianMar 23, 2011 at 16:35