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:

5 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.

  4. 4 van morgiu October 3, 2008 at 10:55 pm

    a tip for Fedora 9 Sulphur:

    the command xfs_admin -L media /dev/sdxx doesn’t work because the correct path of xfs_admin is /usr/sbin/xfs_admin

    so the correct command is
    #/usr/sbin/xfs_admin -L media /dev/sdxx

    however there’s an other problem.
    in fact the script xfs_admin needs to be modified because the command xfs_db is also on the path /usr/sbin

    open a terminal and run
    #gedit /usr/sbin/xfs_admin
    edit the line n° 28 in:
    1) eval /usr/sbin/xfs_db -x -p xfs_admin $OPTS $1
    now save the modifications and quit gedit

    now should be working…
    try again the command
    #/usr/sbin/xfs_admin -L media /dev/sdxx

    for me it works!!


    van morgiu

    sorry for my eventually bad english

  5. 5 Arthur Murgatroyd October 3, 2011 at 4:01 pm

    Did you forget to use fdisk to change the file system type of the partition from 7 HPFS/NTFS/exFAT to 83 Linux?

Comments are currently closed.

June 2007

Blog Stats

  • 376,113 hits

%d bloggers like this: