Bug 113912

Summary: tunefs(8): silent failure setting glabel on boot partition
Product: Base System Reporter: Vick Khera <vivek>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: grahamperrin, rkoberman
Priority: Normal    
Version: 6.2-RELEASE   
Hardware: Any   
OS: Any   

Description Vick Khera 2007-06-21 15:50:07 UTC
	

I am using tunefs -L to label my partitions since I am doing testing on an
external RAID which causes the device names of the boot drive to change from
da0 to da1 or da2.  This all works just fine except that the root partition
cannot be labeled from single-user boot. It seems to fail silently.

Fix: 

Boot from CD into fixit mode and run the above tunefs label command.  This
allows the system to boot properly.

Ideally sysinstall would allow one to set the disk label during newfs time.
How-To-Repeat: 	

reboot into single user mode
run "tunefs -L root /dev/da0s1a" (assuming that's your root partition)
edit /etc/fstab to use /dev/ufs/root as the root partition device name
reboot.

On reboot the loader will not be able to mount the root partition by the
/dev/ufs/root device label name.  No errors are produced on the above tunefs,
and in fact the "success" indicators of the label being created are given on
stdout and the syslog.

The tunefs command works just fine for any other partition from single user
mode.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:12 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 rkoberman 2021-10-19 04:27:19 UTC
System is 13-STABLE from August. 

The title should be updated to "tunefs(8): silent failure change settings on boot partition". Running 13-STABLE and was unable to set TRIM, SUJ, Label. Entered:
tunefs -t enable /dev/nvd0p3
It responded with the standard message and no error. "tunefs -p" showed TRIM enabled. Then mounted the volume RW and checked again and TRIM was disabled. Same with SUJ and Label.

SWAG, a copy of the superblock is located in memory and that is update by tunefs but is not written to disk since it had been mounted RO. When "mount -u /" is executed, the superblock is read in again. Just a guess, but seems to fit the behavior.

Ticket my be updated to "Affects some people".

This ticket has been open for over 14 years with no attention. With the increasing use of SSDs that may miss enabling TRIM on the initial installation requiring the use of tunefs to enable it. I know from experience.