Disk Utility (sitting in System -> Administration) will give you the serial numbers for all your disks.
Here's what I see (look at the top-right for the serial). You'll notice that this drive is within a mdadm RAID array. Disk Utility can penetrate the array for raw disk access.
I have 6 of the same model of disk in my PC so I drew a little diagram showing their position in the case and the serial number so I can locate them quickly on serial in an emergency.
The opposite is also true in that if a disk dies, I just need to find which disks are showing up and I can eliminate them until I know which serial is missing.
Edit: I'm trying to improve my bash-fu so I wrote this command line version to just give you a list of disk serial numbers that are current in your machine. fdisk
may chuck out some errors but that doesn't taint the list:
for disk in `sudo fdisk -l | grep -Eo '(/dev/[sh]d[a-z]):' | sed -E 's/://'`;
do
sudo hdparm -i $disk | grep -Eo 'SerialNo=.*' | sed -E 's/SerialNo=//';
done
(And you can crumble that into one line if you need to - I've broken it up for readability)
Edit 2: ls /dev/disk/by-id/
is somewhat easier ;)
First, obtain the location of your USB drive:
sudo fdisk -l
Assuming that your device location is /dev/sdb1/
:
You can safely check the current label without any side effects by issuing the following command:
sudo file /dev/sdb1 -s
Most USB sticks are formatted using FAT16/FAT32. To change the label via the prompt, use the mlabel
command. The label of a FAT filesystem requires to be exactely 11 characters. No more, no less. When characters are omitted, spaces are added at the beginning, and seemingly random characters are appended at the end.
Install the mtools package (GNU Tools for MSDOS filesystems):
sudo apt-get install mtools
Then you might need to configure the mtools drives settings, hence add the following two lines to /etc/mtools.conf (you will need sudo to edit)
# second and third drives, first partition
drive u: file="/dev/sdb1"
drive v: file="/dev/sdc1"
Having saved, you should then be able to look at your USB drive in (say) /dev/sdb1 as drive u:
sudo mtools -v u:
(See comments ....)
Then relabel:
sudo mlabel -i /dev/sdb1 -s ::"LABEL HERE "
For other filesystems (rarely used for USB sticks), see this page.
Best Answer
Among many other options, you can start application Disk Utility and select the disk/device to rename. Unmount the partition if needed. You can then find an option for assigning new label to the disk - the Edit a Filesystem Label, click that to rename the device.