How to Convert a Transactional Volume to UFS Logging
Note - You must have at least one Mbyte of free space (using default system settings) to convert to UFS logging, because the log requires some space and resides on the logged volume. If you do not have sufficient free space, you will have to remove files or grow your file system before you can complete this conversion process.
To Convert a Transactional Volume to Use UFS Logging
Identify transactional volumes and their associated log devices by using the metastat command and looking for Trans and Logging device in the output.
# metastat d2: Trans State: Okay Size: 2869209 blocks Master Device: d0 Logging Device: d20 d20: Logging device for d2 State: Okay Size: 28470 blocks d20: Concat/Stripe Size: 28728 blocks Stripe 0: (interlace: 32 blocks) Device Start Block Dbase State Reloc Hot Spare d10 0 No Okay No d11 0 No Okay No d12
Note the names for these devices for later use.
Check to see if the Trans device is currently mounted by using the df command and searching for the name of the transactional volume in the output. If the transactional volume is not mounted, go to Step 7.
# df | grep d2 /mnt/transvolume (/dev/md/dsk/d2 ): 2782756 blocks 339196 files
Verify adequate free space on the transactional volume by using the df -k command.
# df -k /mnt/transvolume file system kbytes used avail capacity Mounted on /dev/md/dsk/d2 1391387 91965 1243767 7% /mnt/transvolume
Stop all activity on the file system, either by halting applications or bringing the system to the single user mode.
# init s [root@lexicon:lexicon-setup]$ init s INIT: New run level: S The system is coming down for administration. Please wait. Dec 11 08:14:43 lexicon syslogd: going down on signal 15 Killing user processes: done. INIT: SINGLE USER MODE Type control-d to proceed with normal startup, (or give root password for system maintenance): single-user privilege assigned to /dev/console. Entering System Maintenance Mode Dec 11 08:15:52 su: 'su root' succeeded for root on /dev/console Sun Microsystems Inc. SunOS 5.9 s81_51 May 2002 #
Flush the log for the file system that is logged with lockfs -f.
# /usr/sbin/lockfs -f /mnt/transvolume
Unmount the file system.
# umount /mnt/transvolume
Clear the transactional volume that contains the file system.
This operation will not affect the data on the file system.
# metaclear d2 d2: Trans is cleared
The Logging device, identified at the beginning of this procedure, is now unused and can be reused for other purposes. The master device, also identified at the beginning of this procedure, contains the file system and must be mounted for use.
Edit the /etc/vfstab file to update the mount information for the file system.
You must change the raw and block mount points, and add logging to the options for that file system. With the transactional volume in use, the /etc/vfstab entry looks like this:
/dev/md/dsk/d2 /dev/md/rdsk/d2 /mnt/transvolume ufs 1 no -
After you update the file to change the mount point from the transactional volume d2 to the underlying device d0, and add the logging option, that part of the /etc/vfstab file looks like this:
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/md/dsk/d0 /dev/md/rdsk/d0 /mnt/transvolume ufs 1 no logging
Remount the file system.
# mount /mnt/transvolume
Note - The mount command might report an error, similar to"the state of /dev/md/dsk/d0 is not okay and it was attempted to be mounted read/write. Please run fsck and try again." If this happens, run fsck on the raw device (fsck /dev/md/rdsk/d0 in this case), answer y to fixing the file system state in the superblock, and try again.
Verify that the file system is mounted with logging enabled by examining the /etc/mnttab file and confirming that the file system has logging listed as one of the options.
# grep mnt /etc/mnttab mnttab /etc/mnttab mntfs dev=43c0000 1007575477 /dev/md/dsk/d0 /mnt/transvolume ufs rw,intr,largefiles, logging,xattr,onerror=panic,suid,dev=1540000 1008085006
If you changed to single-user mode during the process, you can now return to multiuser mode.
Example--Converting From Transactional Volumes to UFS Logging
The following example shows the process of converting a transactional volume to UFS logging.
# metastat d50: Trans State: Okay Size: 204687 blocks Master Device: c1t14d0s0 Logging Device: c1t12d0s0 Master Device Start Block Dbase Reloc c1t14d0s0 0 No Yes c1t12d0s0: Logging device for d50 State: Okay Size: 30269 blocks Logging Device Start Block Dbase Reloc c1t12d0s0 5641 No Yes Make note of the 'master' and 'log' devices as you will need this information in subsequent steps. Determine if the transactional volume contains a mounted file system. # df | grep d50 /home1 (/dev/md/dsk/d50 ): 161710 blocks 53701 files Verify sufficient free space (more than 1 MByte) # df -k /home1 filesystem kbytes used avail capacity Mounted on /dev/md/dsk/d50 95510 14655 71304 18% /home1 Go to single-user mode. # /usr/sbin/lockfs -f /home1 # /usr/sbin/umount /home1 # /usr/sbin/metaclear d50 d50: Trans is cleared Update /etc/vfstab file to mount underlying volume and add logging option. # cat /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options /dev/dsk/c1t14d0s0 /dev/rdsk/c1t14d0s0 /home1 ufs 2 yes logging # mount /home1 # /usr/bin/grep /home1 /etc/mnttab /dev/dsk/c1t14d0s0 /home1 ufs rw,intr,largefiles,logging,xattr,onerror=panic,suid,dev=740380 1008019906 Return to multi-user mode. |