0

we have rhel 7.2 server , server is VM server

and we add new disk - sde

with the following example we create ext file system with label - disk2

mkfs.ext4 -L disk2 /dev/sde
mke2fs 1.42.9 (28-Dec-2013)
/dev/sde is entire device, not just one partition!
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=disk2
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
262144 inodes, 1048576 blocks
52428 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

so we get

lsblk -o +FSTYPE,LABEL | grep sde
sde                8:64   0     4G  0 disk                       ext4        disk2

is it possible to create on new disk only the label but without creation of file system?

example of expected output ( without file system on disk )

lsblk -o +FSTYPE,LABEL | grep sde
sde                8:64   0     4G  0 disk                         disk2

3 Answers 3

4

The labels shown by lsblk (or rather, blkid) in its LABEL column are the file system labels, which are only available on file systems capable of storing a label. A block device with no file system can’t have such a label.

GPT partitions can also be labeled, and lsblk shows that with PARTLABEL. But that’s not an option for whole disks either.

4
  • maybe other solution , I will explain my self , lets say we have a new 3 disks , and I want to join one of this disk to VG by some bash script that will do it auto , but script will choose the disk by some identification like label or something similar , so can we do something about this? Commented Jan 26, 2021 at 5:17
  • ok then I will post new question Commented Jan 26, 2021 at 5:31
  • I post new question per you request - unix.stackexchange.com/questions/631027/… Commented Jan 26, 2021 at 5:44
  • regarding my new post do you think its possible ? Commented Jan 26, 2021 at 6:29
2

According to What does disk label mean?

  • There's the label inside partitions (more correctly inside filesystems) just called LABEL by lsblk -f [On all disks but not for special partitions like swap, procfs, sysfs]
  • There's the label outside partitions but in the partition table called PARTLABEL by lsblk -f [Only gpt disks have this capacity]
  • There's the label outermost which as you rightly suspect is more usually called 'partition table'. This last terminology is more used in other Unix cultures eg OpenBSD, Oracle and BSD.
0

On Rhel7 (assuming the backend supports a label)

e2label /dev/sde (display current label) e2label /dev/sde NEWLABEL (Change to or add NEWLABEL)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.