I can't tell which dev/sda/ file is my external hard drive to install Xubuntu on
Solution 1
The disk names in Linux are alphabetical. /dev/sda
is the first hard drive (the primary master), /dev/sdb
is the second etc. The numbers refer to partitions, so /dev/sda1
is the first partition of the first drive.
It is likely that your external drive will not be /dev/sda
, that is more likely to be the internal drive of your machine. To find out the name of your (attached) USB drive, run sudo fdisk -l
.
Example output:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x4b66b5d5
Device Boot Start End Blocks Id System
/dev/sda1 63 80324 40131 de Dell Utility
/dev/sda2 * 81920 30801919 15360000 7 HPFS/NTFS/exFAT
/dev/sda3 30801920 194643539 81920810 7 HPFS/NTFS/exFAT
/dev/sda4 194643601 976773119 391064759+ f W95 Ext'd (LBA)
/dev/sda5 194643603 198836504 2096451 c W95 FAT32 (LBA)
/dev/sda6 342951936 960387071 308717568 83 Linux
/dev/sda7 198840320 342949887 72054784 83 Linux
/dev/sda8 960389120 976773119 8192000 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x484882da
Device Boot Start End Blocks Id System
/dev/sdb1 63 976768064 488384001 7 HPFS/NTFS/exFAT
That command will list all partitions of all connected drives, it will probably include some /dev/sdbX
partitions as well and those are the ones you want. In the output above, my external USB drive is sdb
and has the partition sdb1
.
You can also see the device name of your USB drive with lsblk
:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 39.2M 0 part
├─sda2 8:2 0 14.7G 0 part
├─sda3 8:3 0 78.1G 0 part /winblows
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 2G 0 part
├─sda6 8:6 0 294.4G 0 part /home
├─sda7 8:7 0 68.7G 0 part /
└─sda8 8:8 0 7.8G 0 part [SWAP]
sdb 8:16 0 465.8G 0 disk
└─sdb1 8:17 0 465.8G 0 part
sr0 11:0 1 1024M 0 rom
Again, in the example above, sdb
is my external USB drive.
Solution 2
/dev/sda
it's 100% your internal drive. Your external drive may be sdb, sdc or another one.
To list your drives try: sudo parted -l
to list all drives and information about them.
Solution 3
Run udevadm monitor
and plug in your drive. This will tell you where your drive is at in the dev directory.
For example, one of the output lines from plugging in a USB drive on my PC (partition ID in bold):
KERNEL[90052.302744] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/host6/target6:0:0/6:0:0:0/block/sdd/sdd1 (block)
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
I want to install Xubuntu onto my external hard drive, but I cannot tell what partition to use. Here is what it shows
dev/sda dev/sda1 ntfs dev/sda2 ntfs dev/sda3 ntfs dev/sda4 fat32
sda1-3
are Windows 8 files, but I don't know what the last one is, however I think it might be the hard drive, but I don't want to erase anything. -
Garrett about 6 yearsMy external USB drive is indeed
/dev/sda
. The internal drive of my machine is/dev/nvme0n1
. -
Devon almost 4 yearsSame here. It is possible for secondary and external hard drives to be named
sda
-
terdon almost 4 yearsYes, these are probably laptops with internal nvme SSD drives. Those weren't very common when this answer was written, they have become much more common now.