-1

My 2 TB Hard Drive isn't attached to Linux (Or however you say it) and all I have is my 128 GB disk so I was wondering how I could do it so I have 1 Drive to store all my programs (2 TB one) and the 128 GB one to just store Linux stuff.

enter image description here

So how do I do it like windows where I have A C: and D: drive if I can do that on Linux. I'm new to Linux btw. thanks!

  • The concept of Drive Letters don't exist on Linux. That's entirely a Windows thing only. You can create multiple mountpoints for drives, etc. but your 2TB drive for 'programs' on Windows wont' work for programs on Linux. – Thomas Ward Sep 17 '20 at 17:19
  • 1
    What exactly is the problem you face? Are you unable to mount a volume? Are you getting errors when you do so? Please be specific and share your research with us. – Nmath Sep 17 '20 at 17:21
  • Welcome! We should assume that you installed Ubuntu in your 2tb drive, and want to use the 128gb to store data (it wouldn't be "linux stuff").? – schrodigerscatcuriosity Sep 17 '20 at 17:27
  • @schrodigerscatcuriosity Alright if there isnt that then I would like to use my 2tb drive instead the 128 drive and linux stuff i mean like the os stuff but thats light so nvm – Mimi Sep 17 '20 at 17:35
  • @Mimi You didn't install ubuntu yet then? – schrodigerscatcuriosity Sep 17 '20 at 17:40
2

Disks are attached or "mounted" to folders in the linux filesystem. At boot time, the boot disk and grub find and mount the root partition for you.

Subsequent disks (like your 2TB) are then mounted to empty subfolders of root ("/"). But there are a number of prerequisites:

  • Your 2TB disk must be connected to a controller; IDE,SATA,SAS at boot time, or a USB port (I don't recommend USB if this is going to be a permanent addition).
  • You need to know the actual device path of your connected disk. This can be determined by ls -l /dev/disk/by-id/. This will display a symbolic link to the actual device "/dev/sd.....something". Make absolutely certain you have the correct one!
  • You need to have a mountable partition on the disk. If it is a brand new disk, you can partition the entire device with sudo mkfs.ext4 /dev/disk/by-id/<my-2TB-drive>. Again, make certain you have the correct disk! This command will format the entire disk.
  • You need a mount point. This is just a folder somewhere in your filesystem. A top level one can be created with sudo mkdir /my_programs
  • You need to actually mount the new volume. This can be done manually by sudo mount /dev/disk/by-id/<my-2TB-drive> /my_programs
  • You'll need to grant filesystem permissions to the newly mount volume. "chown" and "chmod" are the linux commands used for assigning ownership and access modes. If you wanted to use the volume exclusively for a given login, say "mimi", this could be done by sudo chown mimi:mimi /my_programs/.

Once you are satisfied with naming and location of everything, you can automate mounting of your 2TB volume by adding an entry to the /etc/fstab file to have it mount automatically at boot time. A typical ext4 mount entry looks like:

UUID=1f759a8d-7150-41be-99d3-bfc99bfd0306 /my_programs ext4 defaults 0 1

A UUID is used to make certain we always mount the exact drive we intend. Since devices can move around, /dev/sdb might not always be /dev/sdb.

You find your devices UUID by ls -l /dev/disk/by-uuid

Alternative Solution On Ubuntu Desktop (as opposed to server), much of the above will be done automatically (or with some prompting) if you attach your disk via USB. But the mount point will change dynamically and USB is not an ideal interface for "big data". Still, many will find it satisfactory and MUCH, MUCH simpler.

Good luck, Mimi. And welcome to Linux!

  • This is a good explanation for beginners. Thank you. – user535733 Sep 17 '20 at 18:11
  • Clearly OP has very little knowledge of file Systems. This answer may just add to their confusion....Good answer though. – EODCraft Staff Sep 17 '20 at 18:12
  • yeah i installed linux like blindly yesterday – Mimi Sep 17 '20 at 18:14
  • the reason i switched is because i can get into the habit of things really quick so I thought I could learn fast but ofc its gonna take like a really long time to understand it – Mimi Sep 17 '20 at 18:19
  • @Frobozz the drive is 4 years old prob but it works fine – Mimi Sep 17 '20 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.