Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to backup data to an external drive that is always connected to the same external USB port.

How do I detect what device the external drive is mapped to?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

There are several ways of dealing with that. To see the attached devices, use sudo fdisk -l. To see where devices are mounted, use mount (before you can use a device, you have to mount it, that is -- attach it to an existing, empty directory which is called "mountpoint").

Even if the device is always conntected to the same USB port, you cannot be sure that it always gets the device. Therefore, use the device ID when mounting:

sudo blkid

This will show you a list of devices along with their UUID's, which determine the devices in a unique manner:

/dev/sda1: UUID="395b2e65-af41-4026-8492-d6f17b08ad8b" TYPE="ext4" 
/dev/sda5: UUID="db9e00d0-afe9-4386-95c1-a11a13324932" TYPE="swap" 
/dev/sda6: UUID="11842584-3992-47c8-81a8-ac1aa498ce2d" TYPE="ext4"

Instead of /dev/sda1, for example, you can access them then by ls /dev/disk/by-uuid/395b2e65-af41-4026-8492-c6f17b08ad8b, which is maybe more obscure, but better.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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