The first one will create an empty directory to mount into and the second will mount the drive into said directory: mkdir -p /media/usb/my_drive mount /dev/ /media/usb/my_drive When you’re ready to mount the disk, execute the following commands, replacing the disk label below with your own. Ensure the size matches and the expected partitions are present on the device. In the output on your machine you should locate the disk label that corresponds to your removable drive. Each disk has a label like: /dev/sda or /dev/sdb. In the output above you can see two different disks of different sizes. You should see some output similar to this: Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 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 Disklabel type: gpt Device Start End Sectors Size Type /dev/sda1 262144 104857566 104595423 49.9G Linux filesystem /dev/sda14 2048 8191 6144 3M BIOS boot /dev/sda15 8192 262143 253952 124M EFI System Partition table entries are not in disk order. First, after you plug the drive in you’ll need to figure out what the device label is. This isn’t really all that difficult and is solved with two simple commands. This is because (unless you’re using a desktop distro) you have to actually mount the drive yourself and tell the OS where to put the files. The first thing you might notice about Linux is that when you plug a removable drive-in, it doesn’t automatically appear anywhere. Note: some of these commands may require root privileges so you may need to run them using sudo. In this article we’ll explore some of the basics for things like mounting drives, copying data, and wiping disks and directories. With just a few simple commands you can quickly lift the veil of uncertainty and become a pro at shuffling data around in Linux. If you’re used to working in a GUI then handling data storage in a CLI might feel a bit scary. Managing files, removable media, and disk drives in Linux can be quite an undertaking if you aren’t fluent in command-line.
0 Comments
Leave a Reply. |