HowTo Rename a XFS-Filesystem (label it)

Yesterday I bought a new 500GB harddisk :) It was formatted with NTFS but I wanted a linux-filesystem. I thought I should give XFS s shot because ext3 is working for me now.

I formatted the disk with the GParted LiveCD but you can also do it with gparted installed in Ubuntu (use apt-get install gparted to get it.) To format the the device simply choose the correct harddrive on the left top and then right click the partition and choose Format to > xfs.

I wanted to name it “media” because of its future content. So I tried the “Set Disklabel” Function but this seems to be for anything other than a Disk Label. In Windows it was rather easy to change the name of a disk per F2 but in Ubuntu *ouch*.

After some searching I found a Guide for renaming USB Drives. And you know what xfs was missing :’( Maybe nobody has an USB Drive formatted with xfs but what about a normal harddisk?

So I continued searching and found a tool collection named xfsprogs. I apt-get it and than wrote xfs in the bash and pressed <TAB> to list the tools.

guru@guru-desktop:~$ xfs
xfs_admin    xfs_copy      xfs_growfs    xfs_logprint  xfs_quota
fs_bmap      xfs_db        xfs_info      xfs_mkfile    xfs_repair
fs_check     xfs_freeze    xfs_io        xfs_ncheck    xfs_rtcp

xfs_admin sounded nice so I read its man page. Here my full proceeding: (Note: Change sdb1 to your disk)

  1. Get xfstools with sudo apt-get install xfsprogs
  2. Unmount the device if it is mounted (sudo umount /dev/sdb1)
  3. Label it with xfs_admin -L media /dev/sdb1
  4. Mount it.
  5. If you formatted it you may have no access to your drive. I solved it by changing the owner to my user instead of root. I do not know if this is the best way, but it worked for me ;-)
    sudo chown guru:guru /media/media

Thats it. It would be so easy if it where in the context menu of sdb1 or so.

For other filesystems see: https://help.ubuntu.com/community/RenameUSBDrive

3 Responses to “HowTo Rename a XFS-Filesystem (label it)”


  1. 1 peter June 21, 2007 at 4:11 pm

    # Label it with xfstools -L media /dev/sdb1

    this should be “xfs_admin”… tnx for the howto

  2. 2 ataub2qf June 21, 2007 at 7:42 pm

    @peter Thanks! Mistake is corrected now =)

  3. 3 Pepe July 25, 2007 at 5:05 pm

    Please correct step 3, substitute xfs_tools so it reads:
    3. “Label it with xfs_admin -L media /dev/sdb1″

    Thank you for the info, that was exactly what I was searching for.