lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAMU1PDjZNXr6Y26EUtCSZFnjJfx7MgCLWNWNRgBb9dSN1pdK_g@mail.gmail.com>
Date:   Fri, 9 Aug 2019 12:01:03 +0100
From:   Mike Fleetwood <mike.fleetwood@...glemail.com>
To:     linux-ext4@...r.kernel.org
Subject: Is it supported to change an ext2/3/4 label while mounted?

Hi,

For Btrfs and more recently XFS they explicitly support changing the
label while mounted.  Documentation is available saying it can be done
and stracing shows it is using a file system specific ioctl() to make
the change.

However for ext2/3/4 file systems I can't find anything explicitly
documented, and stracing "tune2fs -L" shows that it writes directly to
the block device while the file system is mounted.  That seems unsafe as
I presume the kernel would be expecting to have exclusive access to the
block device while the file system is mounted.  However it always seems
to work.  I am wondering if it is safe and supported to change an
ext2/3/4 file system label while it is mounted?

(I have a old GParted enhancement request for this, hence the question.
https://bugzilla.gnome.org/show_bug.cgi?id=600496)

Thanks,
Mike


# mkfs.btrfs /dev/sdb1
# mount /dev/db1 /mnt/1
# strace btrfs filesystem label /mnt/1 btrfs_label
...
open("/mnt/1", O_RDONLY|O_NOATIME)      = 3
ioctl(3, BTRFS_IOC_SET_FSLABEL, "btrfs_label") = 0


# mkfs.xfs /dev/sdb2
# mount /dev/sdb2 /mnt/2
# strace  xfs_io -c "label -s xfs_label" /mnt/2
...
open("/mnt/2", O_RDONLY)                = 3
...
ioctl(3, BTRFS_IOC_SET_FSLABEL, "xfs_label") = 0


# mkfs.ext2 /dev/sdb3
# mount /dev/sdb3 /mnt/3
# strace tune2fs -L ext2_label /dev/sdb3
...
open("/dev/sdb3", O_RDWR)               = 3
...
lseek(3, 134217728, SEEK_SET)           = 134217728
write(3, "\0\200\0\0\0\0\2\0\231\31\0\0\217\367\1\0\365\177\0\0\0\0\0\0\2\0\0\0\2\0\0\0"...,
1024) = 1024
lseek(3, 402653184, SEEK_SET)           = 402653184
write(3, "\0\200\0\0\0\0\2\0\231\31\0\0\217\367\1\0\365\177\0\0\0\0\0\0\2\0\0\0\2\0\0\0"...,
1024) = 1024
fsync(3)                                = 0
lseek(3, 1072, SEEK_SET)                = 1072
write(3, "\vM", 2)                      = 2
lseek(3, 1144, SEEK_SET)                = 1144
write(3, "ext2_label", 10)              = 10
fsync(3)                                = 0
close(3)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ