Today's desktop environments do us all or almost all of the heavy lifting, but what if we don't have a desktop environment, what do we do?
I have always liked the terminal, since I started working with Linux I realized that it was necessary, that I had to learn to use that 'black screen full of letters' if I ever wanted to know enough. Nowadays when I install a system (Debian, Arch, etc) I install 100% terminal, that is, without a graphical environment because this is installed by hand, just as I wish, and this for what? Simple, this way I achieve a lower consumption of resources because the system will only have exactly what I want it to have. Does it make sense or not?
But well to the point ... How to access (mount) a hard drive or partition via terminal?
1. First we will create the folder where we will mount the partition, I like to create / media / temp
mkdir /media/temp
2. We must know what HDDs and partitions we have in the system, for this we will use one of the commands that I presented before in another post: fdisk -l
Let's run in a terminal (remember, with root privileges): fdisk -l
We will see something like this:
I have indicated the important thing with yellow 😉
First we must be clear that what we will mount is a partition of a hard disk, not the hard disk as such, even so the hard disk has a single partition that covers its 500GBs (like mine), so the hard disk is / dev / sdb and the partition that we will mount is / dev / sdb1
I know it is / dev / sdb and not / dev / sda because there I see that sdb is the 500GB HDD, and precisely my external one is the 500GB one, the other (160GB) is the laptop's internal HDD.
3. Well, once we know which partition we want to mount, we simply mount it, we will use the mount command and define which partition we are going to mount (/ dev / sdb1) and in which folder (/ media / temp /):
mount /dev/sdb1 /media/temp/
And voila, just list the content of / media / temp / to verify that it is the content of the partition: ls / media / temp /
By the way, there will be systems that may ask you to be able to mount the partition, you must specify the type of file it has (vfat if it is fat32, ntfs, etc), for this we will use the parameter -t :
mount -t vfat /dev/sdb1 /media/temp
And well, mount has many more options, for this a simple man mount will help you.
Nothing, I hope it has been useful 😉
regards
Excuse my ignorance, KZKG ^ Gaara, but I understood that the / mnt folder was the one used to mount hard drives. In this example that you put it would be "mount / dev / sdb1 / mnt". If I'm wrong, correct me. Greetings and sorry for the meddling.
Hello how are you, welcome 🙂
/ mnt and / media are not that they have much difference, in reality the decision of whether to use one or the other is largely given by the personal taste of each administrator.
I have always created a folder inside / media (/ media / temp /) to mount the device there (in temp /), I never used / mnt (mount / dev / sdb1 / mnt) because, what if I needed to mount in addition what other device did it do to me?
That is why I always preferred to simply create subfolders of / media, however there is nothing wrong with using / mnt far from it 🙂
And no, not at all, it is not meddling at all, you have a question and I will gladly give you my answer, which does not have to be the most accurate or much less 😉
Greetings and once again, welcome to the site ^ - ^
I recommend using lsblk, you don't have to be super-user. And it shows you how important they are, what they are, their size and if they are mounted, where they are.
And I have subfolders in / mnt. For example my usb, mount / dev / sde1 / mnt / usb.
If you are working in a company the correct thing to do would be to use / mnt for important internal partitions and / media for interim devices.
If it is at home, it does not matter what you use as if you mount it in a folder on your desk, it does not matter. It depends on the use you are going to give it.
For permanent partitions I always advise / mnt and / media for external or temporary devices.
Recently I have realized that my computer, from one day to the next, stopped mounting the USB drives and they are not shown under / dev / sd-whatever, I don't know why but in console I can see the following:
USB 1-5: device descriptor read / 64, error -110
Unable to enumerate USB port 2
Can anyone help me?
What if you plug them into different USB ports?
Yes, I already tried but no luck. I also tried other memories but nothing.
I have updated equipment since I use ArchLinux but this problem is there, I never had problems with this before.
I have started the Windows partition and there everything works normally so there are no hardware problems, it must be problems with the configuration. But what?
Try the following, it is possible that your problem is giving you the ehci_hcd module.
cd /sys/bus/pci/drivers/ehci_hcd/
ls
And you should see a file with the following structure: "0000: 00: xx.x" where the 'x' are the ones that vary ..
And to deactivate it you put:
sudo sh -c 'echo -n "0000:00:xx.x" > unbind'
That's one of the solutions I found .. ..if it solves it .. tell us about it .. and we make a small script so that it is done automatically when booting.
Yes sir, the first time.
I did sudo sh -c 'echo -n "0000: 00: 10.4"> unbind'
and the USB drive was mounted like that.
What do I do now? It occurs to me to add a line to the .xinitrc but as it needs administrator permissions I don't know if it will work.
PS: Sorry for the tradanza but I've been off the bridge.
One more question if it is not too much trouble since we are with this to mount partitions. When I bought my second hard drive (since I was short of space) I was so stupid that I have it mounted in / HD2, there directly at the root (and I criticizing your thread, hehe). The point is that when the new Debian Stable arrives, my idea is to format disk one, which is where I have the system installed, but I don't want to touch the content of disk 2 (the new one). Can I mount the latter without problems elsewhere (for example in / media / HD2 or / mnt / HD2) or will it have to be where / HD2 already had it? . Greetings and thanks for the help.
Mount the disk wherever you want, that does not have any problem.
If you want to check / etc / fstab and change the mount point of the disk there to a folder that you like better, then if you want you can make a symbolic link from / media / HD2 to / HD2 in case you want to make sure that something (software, etc) that pointed to / HD2 did not 'get lost' and find everything.
Hello people. Excellent article. I have another option to ride.
mount -t auto
Ah I did not know this 😀
Thanks for the input.
good this
Hello friend, can you put the complete command? I'm a newbie, well, let me explain, look, I can't see my hard drive in Files, I don't know if it's mounted or not, but in Gparted I do see it, how can I view and enter my personal data? Regards.
An excellent Post, in my opinion you just need to put how to make the partitions mount from the beginning from the fstab for those who have no idea how, I leave that little contribution:
edit fstab with your preferred text editor:
example
sudo nano / etc / fstab
inside add until the end the following data of your partition:
Example.
Partition, place type options
/ dev / sda3 / mnt / Data ntfs-3g defaults 0 0
at this point we must have created the folder where the partition will be mounted, if not, create it now.
Following the example:
sudo mkdir -p / mnt / Data
I hope I have helped. Cheers
Yes, I forgot to put something about this in the post 🙂
What happens is that I had already made a post a few days ago precisely about this: https://blog.desdelinux.net/con-fstab-como-montar-automaticamente-una-particion-ntfs/
Nothing thank you very much for remembering it, I really do 😀
regards
@ Tarkin88
Do you have my fstab? ... I use it the same way ... xD
/ dev / sda3 / mnt / ntfs data
LOL..
@ RAW-Basic Actually I put Media, but certainly before I put Data: 3
@ KZKG ^ Gaara you're welcome. Keep up these excellent posts!
That's what I try ... I've always preferred to put technical articles before news, there are already too many sites that are dedicated to putting news, what is needed is sites that put tutorials 😀
KZKG ^ Gaara, I already edited my / etc / fstab and put my disk two in / mnt / HD2. Restart the computer and everything is perfect. Greetings and thanks for the help.
No need to restart, a mount -a is enough.
A pleasure to help 🙂
regards
Thanks for the tip, dhunter. I guess I still carry bad habits (difficult to remove) from my times with Windows.
The info is good, it is never too much these tips refresh memory. 🙂
Mounting devices or partitions can actually be done in any folder. The use of "media" or "mnt" is more than anything else for organization.
Other "tricks" with mount
The basic syntax is what KZKG ^ Gaara says
"-T" refers to the type of files that we are going to mount, but depending on the case it is not necessary to do so. For example, when there is an entry in fstab for the device in question, it would be worth executing "mount / deb / sdx" without specifying the type of files or mounting location.
For the same case that it is reflected in fstab, "mount -a" would do, which means to mount everything reflected in fstab.
Another example: mounting an iso image (from Ubuntu itself) in a folder (the file type for "iso" is "iso9660")
mount -t iso9660 UbuntuImage.iso MountFolder
It would also be worth:
mount -t auto UbuntuImage.iso MountFolder
or even sometimes:
mount UbuntuImage.iso MountFolder
Now they could navigate through the UBUNTU iso as if it were one more folder, and within this file system of the ubuntu iso they could see a file called something like (I say from memory) "filesystem.sqfs" inside the folder " casper / »I think I remember. Well, this file is a squashfs compress that contains the ubuntu system itself. They would easily recognize him because he is the greatest of all.
And this squashfs file would also be mountable as if it were a device, and they could do it, assuming they mounted such the example that I said above, as follows:
mount -t squashfs mountfolder / casper / filesystem.sqfs FolderWhere We Want to Mount
Done this, they would find the root structure of the UBUNTU system. It would be basically the same for other distros (as long as they are compressed with squashfs). (The first assembly of the iso for all).
Mount also allows mounting folders from other systems (windows pe)
By hostname (note that for network mounting it is preceded by a double slash)
mount -t cifs // HowToCallWindows / WindowsSharedFolder FolderWhereWeWant to Mount
Or by IP
mount -t cifs //192.168.1.x/Windows SharedFolder FolderWhereWe want to Mount
The possibilities are endless.
To unmount anything that we have mounted, just execute the same command but instead of "mount", "umonut".
Sorry for the pain, but when you get the hang of mount, they can do wonders.
Well this post, and the comments, I download everything for further reading and also to clarify any possible doubts to some friends who have just begun to migrate here, thanks guys!
Long live KDE damn ..!
hahahaha it usually happens 🙂
One way to mount the partitions is as follows:
UUID = 0AAC5DADAC5D9453 / mnt / windows ntfs defaults, umask = 007, gid = 46 0
I quote:
«On a hard disk, each partition is associated with a standard unique identifier called UUID or Universally Unique Identifie
In GNU / Linux, the advantage of using this identifier in the fstab file (/ etc / fstab), where the partitions to be loaded during system startup are established, is that it is independent of the number of devices (hard disks) connected, for avoiding problems when adding a new hard drive to the computer. "
«Thus, if you have an external hard drive, identified for example by / dev / sdb1, and mounted in / home / Backup, when a new hard drive is added, the initially installed external hard drive may have been renamed / dev / sdc1, the new hard disk now having the name / dev / sdb1. In this case, the desired partition in / home / Backup would not be mounted during the next boot.
To avoid this, it is necessary to replace / dev / sdb1 with the corresponding UUID of that partition in fstab. The way to find out this identifier of a specific partition, for example of / dev / sdb1 would be through the command
sudo blkid / dev / sdb1
After replacing / dev / sdb1 with the obtained UUID value, the partition will be mounted in the desired location, regardless of the number of hard drives connected.
great contribution 😛
you can do many things with the terminal
Thanks for reading 🙂
Phenomenal man
Achieve The Grail Of Slax 7 USB Linux
View Hard Drives With Their Respective Partitions
And Mount The Partitions
A Thousand Congratulations On Your Contribution To Knowledge
Hello everyone,
I have a problem with an external hard drive,
Before it was mounted alone but now not anymore, so I tried everything in the tutorial and still does not want,
when I mount it it says:
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 (eg / dev / sda, not / dev / sda1)? Or the other way around? »
even though what fdisk -l says is that if it is a system type ntfs,
so I do not know what to do, as recommended there I tried to mount sdb instead of the one but it does not matter, what do I do? !!!
Greetings everyone 🙂
hello friend, did you solve your problem? esque I have the same, and maybe you can help me, greetings.
Hey.
Hello, when I mount the Windows partition in fedora it does it in the following path / run / media / foo /
Does anyone know why you choose that directory?
I was able to successfully mount my USB disk, what I can't do is write, I already tried chmod 666, or chmod 7 and it tells me Read-only file system, how can I change the permissions on my disk?
Please help……
Very clear and has gotten me out of a pretty tight spot. Thank you!!!!
Hi Gaara .. I know this post is old but I want to add my 500gb hdd so I can also install and save everything there instead of my 120gb ssd .. I am new to Ubuntu 14.04 .. if you can give me a hand 😀
regards
When I want to enter the (temp) folder it tells me access denied
Hi, I have a problem with 2 1tb disk, I had it in an HP media Vault rack and now the box does not read them, I search the internet and it tells me that I can mount the partition through linux, I connect the disk to my linux system but since I connect the disk I get the following:
[1517.620323] usb 4-1.1: device descriptor read / 64, error -32
[1642.988137] usb 4-1.1: device not accepting address 92, error -32
[1642.989555] usb 4-1-port1: unable to enumerate USB device,
when I type the command sudo fdisk -l I get the following:
the entries in the partition table are not in disk order
[1813.319768] blk_upfate_resquest: critical target error, dev sdb, sector 0
[1813.322284] buffer I / O error on dev sdb, logical block 0, asyng page read
[1813.335995] blk_update_resquest: critical target error, dev sdb, sector 1952151544
Hello:
Aldo, those messages are that the hard drive is damaged, you have to try to recover the information immediately
I want to mount a disk but by mistake when I want to install Windows I change it from format to MRB and Mac requires GUID as I change it to its original format without damaging the data. Greetings and thanks
Windows is hibernated, refused to mount.
Failed to mount '/ dev / sdc2': Operation not allowed
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.
I don't have Windows installed !!
What the hell? ._.
Thank you so much bro! I can already navigate my partition with windows! Cheers
Hola!
I have a question, would it be possible to mount the same hard drive in two places at the same time? For example, mount it in / media / and in / home / tmp
Thanks, it's a great article!
old man thanks for your time and share your knowledge I did the steps you indicate and so far I have not been able to mount the ntfs partition
after using the commands I get this
amin amin # mount / dev / sdb3 / mnt / temp /
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/ dev / sdb3': Operation not allowed
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.
I don't know what I'm doing wrong I have linux mint v18 and I'm new to linux, please help me in that partition are the files that I backed up from windows
Thank you.
The information helped me a lot.
Previously I created a folder in / media with mkdir and in that directory mount the partition, again thank you very much
Hi..can someone help me to mount a GPT type disk.? I do not know about the subject, I would greatly appreciate the help to be able to recover my files.
Dear, I followed the instructions to the letter, but this message appeared:
99.444275] sd 3: 0: 0: 0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[99.502618] sdc: sdc1
[99.503649] sd 3: 0: 0: 0: [sdc] Attached SCSI disk
[1477.558079] EXT4-fs (sdc1): VFS: Can't find ext4 filesystem
[1477.558288] EXT4-fs (sdc1): VFS: Can't find ext4 filesystem
[1477.558526] EXT4-fs (sdc1): VFS: Can't find ext4 filesystem
[1477.558759] FAT-fs (sdc1): bogus number of reserved sectors
[1477.558761] FAT-fs (sdc1): Can't find a valid FAT filesystem
[1548.394946] FAT-fs (sdc1): bogus number of reserved sectors
[1548.394951] FAT-fs (sdc1): Can't find a valid FAT filesystem
I'm desperate since I have all my info on the hard drive, and I can't mount it ...
I hope, in advance, thank you
Good morning.
In the event that you connect an external usb disk, just identifying it and mounting it would be enough to be able to use it?
It is not necessary to format that external usb disk for linux to recognize it or be valid to use it?
I apologize in advance if you already consult this in any comment.
From already thank you very much. I await your response.
DN
Good morning, I am trying to mount an external 4TERAS unit but when mounting the unit it generates an error and if it mounts it does not take the real space, I already have three units mounted but the fourth does not leave me, I have tried with the commands mentioned here but it has not been possible
[root @ backups /] # lsblk
NAME MAJ: MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 3.7T 0 disk
ââsdb1 8:17 0 128M 0 part
ââsdb2 8:18 0 3.7T 0 part
sr0 11: 0 1 1024M 0 rom
sda 8: 0 0 696.8G 0 disk
ââsda1 8: 1 0 512M 0 part / boot
ââsda2 8: 2 0 696.3G 0 part
âârootvg-rootlv (dm-0) 253: 0 0 5.9G 0 lvm /
âârootvg-swap1lv (dm-1) 253: 1 0 4G 0 lvm [SWAP]
âârootvg-loglv (dm-2) 253: 2 0 4G 0 lvm / var / log
âârootvg-tmplv (dm-3) 253: 3 0 4G 0 lvm / tmp
sdc 8:32 0 3.7T 0 disk
ââsdc1 8:33 0 3.7T 0 part / backup2
sdd 8:48 0 3.7T 0 disk
ââsdd1 8:49 0 3.7T 0 part / backup
sde 8:64 0 3.7T 0 disk
ââsde1 8:65 0 128M 0 part
ââsde2 8:66 0 3.7T 0 part / backup3
I have problems with a usb drive, which was infected in a windows pc, and I wanted to know how I can clean it and recover my files through the terminal, please help me in advance, thanks.
it is useless feka
Excellent, it helped me a lot. So they should be most of the posts, clear with effective help without babbling. Thank you