How to find a not formatted hard disk on Linux
Solution 1:
Abruzzo,
In Linux, all your disks can be found under the /dev directory, depending on their type, they can be named hd or sd.
For example, if your first disk is a SATA, it will be named sda. Other entries under /dev will have the same name followed by a number meaning a partition of the disk, like sda1.
Your can find all your disks and partitions using:
ls -ltr /dev/sd*
The new disk will be named sdb.
Solution 2:
I'd use this command to list the disks:
sudo fdisk -l
Solution 3:
All block devices that Linux knows about when it boots are given in /sys/block. If your device isn't there it means Linux did not register it when it booted. In this case, commands given in some of the other answers dealing with upper level filesystem or partition structures aren't relevant (/etc/fstab, fdisk, mount). If your device isn't in /sys/block, then you need to power down, make sure the device is attached and make sure the BIOS recognizes it. If your device is attached and the BIOS does not recognize it, then the device is not receiving power, malfunctioning, or its cable is bad.
Solution 4:
Use sudo fdisk
(or maybe better sudo cfdisk
) to create partitions on a disk. (Create partitions before formatting). With cfdisk
you can see which disks have which partitions and which disks have no partitions at all.
You may probably want to create just one partition per disk. This partition's type should be set to "83" (Linux). You may also create a swap (82) partition.
After you create a partition, you can format your partition by the command:
sudo mke2fs -t ext4 /dev/sdb4
(assuming your partition is /dev/sdb4).
Use this command with extreme care as it may probably erase all information in the partition.
If you created a swap partition use the command like the following:
sudo mkswap /dev/sdb2
(assuming your partition is /dev/sdb2).
The last but not least thing to do is to edit /etc/fstab
.