Showing posts with label dosfslabel. Show all posts
Showing posts with label dosfslabel. Show all posts

Saturday, July 21, 2012

Changing Storage Label on Linux

On Windows, you can simply right click on a device and rename it. On Linux in the other hands, you can use the following method:

During formatting, use let say if you want FAT as the filesystem:


Let say the device is located in /dev/sdc and I want it to be named as "najmi-archsight". Issue this command:

sudo mkfs.vfat  -I /dev/sdc -n "najmi-archsight"

While let say in the other hand, you already got a data inside and want to change the label, use dosfslabel:

1- If the device is mounted, unmount it first
2- Issue this command:

Let say here I want to rename the device to "najmi-csm". The device is firstly mounted at /media/B807-ED09.

najmi@vostro:~$ df -kh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        47G   42G  3.1G  94% /
udev            1.9G  4.0K  1.9G   1% /dev
tmpfs           752M  1.4M  750M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.9G   88K  1.9G   1% /run/shm
/dev/sda6       173G  164G   12K 100% /home
/dev/sdb        2.0G  4.0K  2.0G   1% /media/najmi-archs
/dev/sdc        3.8G  2.5M  3.8G   1% /media/B807-ED09
 

Unmount first:
najmi@vostro:~$ sudo umount /media/B807-ED09/
 

Label it:
najmi@vostro:~$ sudo dosfslabel /dev/sdc "najmi-csm"
 

Check and plug back/mount the drive:
najmi@vostro:~$ df -kh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        47G   42G  3.1G  94% /
udev            1.9G  4.0K  1.9G   1% /dev
tmpfs           752M  1.4M  750M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.9G   88K  1.9G   1% /run/shm
/dev/sda6       173G  164G  4.0K 100% /home
/dev/sdb        2.0G  4.0K  2.0G   1% /media/najmi-archs
/dev/sdc        3.8G  2.5M  3.8G   1% /media/najmi-csm

As you can see, device /media/B807-ED09 was changed to /media/najmi-csm