VM Disk Question

Home » CentOS » VM Disk Question
CentOS 3 Comments

I have VMPlayer 12 running a CentOS 7 disk. Works fine.

However I wish to change the disk from UUID booting (fstab) to the old style LABEL.
(so I can export it and use on another machine).

fdisk -l /dev/sda Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0001c6d3

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 20482047 10240000 83 Linux
/dev/sda2 20482048 22530047 1024000 82 Linux swap / Solaris
/dev/sda3 22530048 41943039 9706496 83 Linux

however when I run:
e2label /dev/sda1 /
e2label: Bad magic number in super-block while trying to open /dev/sda1
Couldn’t find valid filesystem superblock.

Three questions:
1) Am I doing something wrong?
2) Is there a better way?
3) How do I support VM formats (VBox, VHD and VMWare) easily?

Thanks, Jerry

3 thoughts on - VM Disk Question

  • Is this an xfs filesystem or an ext4 filesystem? I could be wrong, but I
    suspect that e2label would only work on an ext2/3/4 filesystem. The default filesystem in RHEL/CentOS 7 is xfs. It looks like you can check labels on xfs filesystems with

    xfs_admin -l

    and you can set a label on an xfs filesystem with

    xfs_admin -L “

    If you run “blkid” on your system it will give you all labels for all disks connected to your machine for any filesystem types that it understands.

    I don’t think this has anything to do with physical or virtual disks or virtual disk formats either. Here we are just talking abut filesystems.

    Hope this helps.

    Barry

  • Hi Barry,

    It is an XFS file system.

    I ran the command:
    xfs_admin -L “/” /dev/sda1

    and it says /dev/sda1 contains a mounted file system. fatal error.

    Now what?
    Thanks

    Jerry

  • Jerry Geis wrote:


    And the answer is that the mount handling is broken in 7, and I’ve filed a bug over a year ago. The workaround solution is to *not* put slashes in the LABEL; instead, do

    e2label /dev/sda1 root

    or, another filesystem, to use what we use, e2label /dev/sdb1 export1
    which we mount as /export/1. Alternatively, mkfs.xfs -L /dev/sdb1 export1

    mark