Format and mount USB in Linux
Suppose you have a completely new 4TB hard drive recently and want to add it to your computer. You need to mount it in Linux. To do this, you need to take the following steps:
- A. Partitioning the hard drive in Linux
- B. Format USB in Linux
- C. Mount USB in Linux (including auto mount after reboot)
- D. Check if the hard drive is mounted
A. Partitioning the hard drive in Linux
Step 1 : First, after connecting the hard drive to the computer with a SATA cable and power cable, you can test the new 4TB hard drive with the command:
sudo fdisk -l
Step 2 : But you cannot mount it now, if you mount it immediately, an error will appear. You need to partition it first:
sudo fdisk /dev/sdb
Step 3 : If you enter m
for help, you can see the command list.
Step 4 : To check the partition table, enter p
.
Step 5 : To partition, enter n
. For example then simply select the primary partition by entering p
and entering 1
for only some partitions.
Step 6 : Enter w
to write the partition table to the drive.
B. Format USB in Linux
The USB format in Ubuntu with the Terminal command is much easier than in Windows. But some Ubuntu users are not familiar with Terminal commands. This tutorial will help Ubuntu users (Linux) take simple steps to format USB.
Step 1 : Insert the USB and determine the volume
Insert the USB into the system and determine the correct USB drive. This is a step you need to take care of, because you can format the drive incorrectly if your drive is not correctly identified.
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 28G 24G 2.3G 92% / udev 1.4G 12K 1.4G 1% /dev tmpfs 277M 1.2M 276M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.4G 34M 1.4G 3% /run/shm /dev/sdc1 14.8G 1.4G 13.4G 10% /media/tecadmin
Now, the example has determined the drive / dev / sdc1 is a 16GB USB attached.
Step 2 : Format USB in Linux
Whenever you mount USB in Ubuntu, it will automatically mount to the system. You cannot format any drive on mounted Linux systems. So first unmount the USB drive / dev / sdc1 on the system.
sudo umount /dev/sdc1
Now, use one of the following commands on the file system you want. To format USB, most users prefer VFAT and NTFS file systems because they can be easily used on Windows operating systems.
- Format with vFat file system:
sudo mkfs.vfat /dev/sdc1
- Format with NTFS file system:
sudo mkfs.ntfs /dev/sdc1
- Format with EXT4 file system:
sudo mkfs.ext4 /dev/sdc1
Similarly, you can format the USB flash drive with any required file system.
C. Mount USB in Linux (including auto mount after reboot)
Step 1 : Normally, the hard drive is mounted in / mnt /. Create a new folder in / mnt / first.
sudo mkdir /mnt/sdb
Step 2 : After that, you can mount it with the command:
sudo mount /dev/sdb /mnt/sdb
Step 3 : But you need to mount it every time you reboot. To automatically mount after every reboot, we will use nano to modify the / etc / fstab file:
nano /etc/fstab
Step 4 : Enter the following command at the end of the file:
/dev/sdb /mnt/sdb ext4 defaults 0 0
The first item is the path for the hard drive. The second is the destination of the mounted drive (where you want to mount the drive). The third is the format. The fourth to sixth items remain the same by default of 0 and 0 .
D. Check if the hard drive is mounted
There are 3 methods to test. All three methods can find the sdb mounted hard drive.
1. mount
mount | grep sdb
2. lsblk
lsblk
3. df
df
Hope you are succesful.
You should read it
- How to mount remote directory in Linux with SSHFS
- How to Create and Use ISO Files on Linux
- How to Remove a TV from a Mount
- How to format a storage drive using Linux Terminal
- How to format a hard drive into NTFS in Linux
- Add the option to Mount right-click menu in Windows 8
- How to Format a Linux Hard Disk to Windows
- Instructions for installing basic Arch Linux
May be interested
- How to Format a Linux Hard Disk to Windowswindows operating system and linux execute best on their specific file systems. it is a known fact that linux executes better on hard disks that are formatted using the ext3 file format system, whereas windows executes well in a disk that...
- Add the option to Mount right-click menu in Windows 8with versions from windows 8 and above, microsoft has assisted users in using iso and img file packages via the mount option integrated in the right-click menu without the need for virtual drive creation software. however, for some reason, this option may not appear on your computer. but don't worry, we'll show you how to add this feature in the article below. please take a look.
- How to manually mount/unmount USB devices on Ubuntuthis guide will explain how to manually mount and unmount a usb into your system.
- Instructions for installing basic Arch Linuxunlike ubuntu or linux mint, arch linux is a distributed linux distribution in a continuous format (rolling release). read the following article to know how to install this distro.
- How to use pandoc to convert files on Linuxyou can use pandoc on linux to convert over 40 different file formats. you can also use it to create a simple docs-as-code system by writing to markdown, saving with git and exporting it in any supported format.
- How to install and use Caliber on Linuxcaliber is a great program for e-book management. caliber is not only allowed to maintain and organize your ebook library, but also to perform format conversions.
- How to mount a folder as a virtual drive on Windowsin windows, you can mount any folder at any location as a virtual drive with a drive letter. this article will show you how to mount a folder as a virtual drive with a drive letter on windows 7, windows 8 and windows 10.
- Instructions to format USB Pendrives with Command Promptby default, windows users can usually format the hard drive, memory card, or usb by right-clicking on it and clicking the format option.
- How to mount the antenna to capture most DVB-T2 channelscurrently dvb t2 digital television is increasingly diverse in terms of number of channels and attractive programs: entertainment, news, news, etc. however, if you want to enjoy all the content, you need it is necessary to select the location and install the antenna accordingly to obtain the best signal and watch the most dvb-t2 channels.
- How to Format USB on Ubuntuwith ubuntu linux, you can use several utilities to format usb, such as the disk utility feature that comes with ubuntu or terminal. regardless of which feature you use, formatting the usb will only take you a few minutes.