2 * tune2fs.c - Change the file system parameters on an ext2 file system
4 * Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr>
5 * Laboratoire MASI, Institut Blaise Pascal
6 * Universite Pierre et Marie Curie (Paris VI)
8 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o.
11 * This file may be redistributed under the terms of the GNU Public
19 * 93/10/31 - Added the -c option to change the maximal mount counts
20 * 93/12/14 - Added -l flag to list contents of superblock
21 * M.J.E. Mol (marcel@duteca.et.tudelft.nl)
22 * F.W. ten Wolde (franky@duteca.et.tudelft.nl)
23 * 93/12/29 - Added the -e option to change errors behavior
24 * 94/02/27 - Ported to use the ext2fs library
25 * 94/03/06 - Added the checks interval from Uwe Ohse (uwe@tirka.gun.de)
28 #define _XOPEN_SOURCE 500 /* for inclusion of strptime() */
29 #define _BSD_SOURCE /* for inclusion of strcasecmp() */
44 #include <sys/types.h>
46 #include "ext2fs/ext2_fs.h"
47 #include "ext2fs/ext2fs.h"
48 #include "et/com_err.h"
49 #include "uuid/uuid.h"
53 #include "blkid/blkid.h"
55 #include "../version.h"
56 #include "nls-enable.h"
58 const char * program_name = "tune2fs";
60 char * new_label, *new_last_mounted, *new_UUID;
62 static int c_flag, C_flag, e_flag, f_flag, g_flag, i_flag, l_flag, L_flag;
63 static int m_flag, M_flag, r_flag, s_flag = -1, u_flag, U_flag, T_flag;
64 static time_t last_check_time;
65 static int print_label;
66 static int max_mount_count, mount_count, mount_flags;
67 static unsigned long interval, reserved_blocks;
68 static double reserved_ratio;
69 static unsigned long resgid, resuid;
70 static unsigned short errors;
72 static char *features_cmd;
73 static char *mntopts_cmd;
75 int journal_size, journal_flags;
78 static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n");
80 void do_findfs(int argc, char **argv);
82 static void usage(void)
85 _("Usage: %s [-c max_mounts_count] [-e errors_behavior] "
87 "\t[-i interval[d|m|w]] [-j] [-J journal_options]\n"
88 "\t[-l] [-s sparse_flag] [-m reserved_blocks_percent]\n"
89 "\t[-o [^]mount_options[,...]] [-r reserved_blocks_count]\n"
90 "\t[-u user] [-C mount_count] [-L volume_label] "
91 "[-M last_mounted_dir]\n"
92 "\t[-O [^]feature[,...]] [-T last_check_time] [-U UUID]"
93 " device\n"), program_name);
97 static __u32 ok_features[3] = {
98 EXT3_FEATURE_COMPAT_HAS_JOURNAL |
99 EXT2_FEATURE_COMPAT_DIR_INDEX, /* Compat */
100 EXT2_FEATURE_INCOMPAT_FILETYPE| /* Incompat */
101 EXT4_FEATURE_INCOMPAT_FLEX_BG,
102 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER /* R/O compat */
106 * Remove an external journal from the filesystem
108 static void remove_journal_device(ext2_filsys fs)
113 journal_superblock_t *jsb;
116 int commit_remove_journal = 0;
120 commit_remove_journal = 1; /* force removal even if error */
122 uuid_unparse(fs->super->s_journal_uuid, buf);
123 journal_path = blkid_get_devname(NULL, "UUID", buf);
127 ext2fs_find_block_device(fs->super->s_journal_dev);
132 #ifdef CONFIG_TESTIO_DEBUG
133 io_ptr = test_io_manager;
134 test_io_backing_manager = unix_io_manager;
136 io_ptr = unix_io_manager;
138 retval = ext2fs_open(journal_path, EXT2_FLAG_RW|
139 EXT2_FLAG_JOURNAL_DEV_OK, 0,
140 fs->blocksize, io_ptr, &jfs);
142 com_err(program_name, retval,
143 _("while trying to open external journal"));
144 goto no_valid_journal;
146 if (!(jfs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
147 fprintf(stderr, _("%s is not a journal device.\n"),
149 goto no_valid_journal;
152 /* Get the journal superblock */
153 if ((retval = io_channel_read_blk(jfs->io, 1, -1024, buf))) {
154 com_err(program_name, retval,
155 _("while reading journal superblock"));
156 goto no_valid_journal;
159 jsb = (journal_superblock_t *) buf;
160 if ((jsb->s_header.h_magic != (unsigned) ntohl(JFS_MAGIC_NUMBER)) ||
161 (jsb->s_header.h_blocktype != (unsigned) ntohl(JFS_SUPERBLOCK_V2))) {
162 fputs(_("Journal superblock not found!\n"), stderr);
163 goto no_valid_journal;
166 /* Find the filesystem UUID */
167 nr_users = ntohl(jsb->s_nr_users);
168 for (i=0; i < nr_users; i++) {
169 if (memcmp(fs->super->s_uuid,
170 &jsb->s_users[i*16], 16) == 0)
174 fputs(_("Filesystem's UUID not found on journal device.\n"),
176 commit_remove_journal = 1;
177 goto no_valid_journal;
180 for (i=0; i < nr_users; i++)
181 memcpy(&jsb->s_users[i*16], &jsb->s_users[(i+1)*16], 16);
182 jsb->s_nr_users = htonl(nr_users);
184 /* Write back the journal superblock */
185 if ((retval = io_channel_write_blk(jfs->io, 1, -1024, buf))) {
186 com_err(program_name, retval,
187 "while writing journal superblock.");
188 goto no_valid_journal;
191 commit_remove_journal = 1;
194 if (commit_remove_journal == 0) {
195 fputs(_("Journal NOT removed\n"), stderr);
198 fs->super->s_journal_dev = 0;
199 uuid_clear(fs->super->s_journal_uuid);
200 ext2fs_mark_super_dirty(fs);
201 fputs(_("Journal removed\n"), stdout);
205 /* Helper function for remove_journal_inode */
206 static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
207 int blockcnt EXT2FS_ATTR((unused)),
208 void *private EXT2FS_ATTR((unused)))
214 ext2fs_unmark_block_bitmap(fs->block_map,block);
215 group = ext2fs_group_of_blk(fs, block);
216 fs->group_desc[group].bg_free_blocks_count++;
217 fs->super->s_free_blocks_count++;
222 * Remove the journal inode from the filesystem
224 static void remove_journal_inode(ext2_filsys fs)
226 struct ext2_inode inode;
228 ino_t ino = fs->super->s_journal_inum;
230 retval = ext2fs_read_inode(fs, ino, &inode);
232 com_err(program_name, retval,
233 _("while reading journal inode"));
236 if (ino == EXT2_JOURNAL_INO) {
237 retval = ext2fs_read_bitmaps(fs);
239 com_err(program_name, retval,
240 _("while reading bitmaps"));
243 retval = ext2fs_block_iterate(fs, ino, 0, NULL,
244 release_blocks_proc, NULL);
246 com_err(program_name, retval,
247 _("while clearing journal inode"));
250 memset(&inode, 0, sizeof(inode));
251 ext2fs_mark_bb_dirty(fs);
252 fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
254 inode.i_flags &= ~EXT2_IMMUTABLE_FL;
255 retval = ext2fs_write_inode(fs, ino, &inode);
257 com_err(program_name, retval,
258 _("while writing journal inode"));
261 fs->super->s_journal_inum = 0;
262 ext2fs_mark_super_dirty(fs);
266 * Update the default mount options
268 static void update_mntopts(ext2_filsys fs, char *mntopts)
270 struct ext2_super_block *sb= fs->super;
272 if (e2p_edit_mntopts(mntopts, &sb->s_default_mount_opts, ~0)) {
273 fprintf(stderr, _("Invalid mount option set: %s\n"),
277 ext2fs_mark_super_dirty(fs);
281 * Update the feature set as provided by the user.
283 static void update_feature_set(ext2_filsys fs, char *features)
285 int sparse, old_sparse, filetype, old_filetype;
286 int journal, old_journal, dxdir, old_dxdir;
287 int flex_bg, old_flex_bg;
288 struct ext2_super_block *sb= fs->super;
289 __u32 old_compat, old_incompat, old_ro_compat;
291 old_compat = sb->s_feature_compat;
292 old_ro_compat = sb->s_feature_ro_compat;
293 old_incompat = sb->s_feature_incompat;
295 old_sparse = sb->s_feature_ro_compat &
296 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
297 old_filetype = sb->s_feature_incompat &
298 EXT2_FEATURE_INCOMPAT_FILETYPE;
299 old_flex_bg = sb->s_feature_incompat &
300 EXT4_FEATURE_INCOMPAT_FLEX_BG;
301 old_journal = sb->s_feature_compat &
302 EXT3_FEATURE_COMPAT_HAS_JOURNAL;
303 old_dxdir = sb->s_feature_compat &
304 EXT2_FEATURE_COMPAT_DIR_INDEX;
305 if (e2p_edit_feature(features, &sb->s_feature_compat,
307 fprintf(stderr, _("Invalid filesystem option set: %s\n"),
311 sparse = sb->s_feature_ro_compat &
312 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
313 filetype = sb->s_feature_incompat &
314 EXT2_FEATURE_INCOMPAT_FILETYPE;
315 flex_bg = sb->s_feature_incompat &
316 EXT4_FEATURE_INCOMPAT_FLEX_BG;
317 journal = sb->s_feature_compat &
318 EXT3_FEATURE_COMPAT_HAS_JOURNAL;
319 dxdir = sb->s_feature_compat &
320 EXT2_FEATURE_COMPAT_DIR_INDEX;
321 if (old_journal && !journal) {
322 if ((mount_flags & EXT2_MF_MOUNTED) &&
323 !(mount_flags & EXT2_MF_READONLY)) {
324 fputs(_("The has_journal flag may only be "
325 "cleared when the filesystem is\n"
326 "unmounted or mounted "
327 "read-only.\n"), stderr);
330 if (sb->s_feature_incompat &
331 EXT3_FEATURE_INCOMPAT_RECOVER) {
332 fputs(_("The needs_recovery flag is set. "
333 "Please run e2fsck before clearing\n"
334 "the has_journal flag.\n"), stderr);
337 if (sb->s_journal_inum) {
338 remove_journal_inode(fs);
340 if (sb->s_journal_dev) {
341 remove_journal_device(fs);
344 if (journal && !old_journal) {
346 * If adding a journal flag, let the create journal
347 * code below handle creating setting the flag and
348 * creating the journal. We supply a default size if
353 sb->s_feature_compat &= ~EXT3_FEATURE_COMPAT_HAS_JOURNAL;
355 if (dxdir && !old_dxdir) {
356 if (!sb->s_def_hash_version)
357 sb->s_def_hash_version = EXT2_HASH_TEA;
358 if (uuid_is_null((unsigned char *) sb->s_hash_seed))
359 uuid_generate((unsigned char *) sb->s_hash_seed);
361 if (!flex_bg && old_flex_bg) {
362 if (ext2fs_check_desc(fs)) {
363 fputs(_("Clearing the flex_bg flag would "
364 "cause the the filesystem to be\n"
365 "inconsistent.\n"), stderr);
370 if (sb->s_rev_level == EXT2_GOOD_OLD_REV &&
371 (sb->s_feature_compat || sb->s_feature_ro_compat ||
372 sb->s_feature_incompat))
373 ext2fs_update_dynamic_rev(fs);
374 if ((sparse != old_sparse) ||
375 (filetype != old_filetype)) {
376 sb->s_state &= ~EXT2_VALID_FS;
377 printf("\n%s\n", _(please_fsck));
379 if ((old_compat != sb->s_feature_compat) ||
380 (old_ro_compat != sb->s_feature_ro_compat) ||
381 (old_incompat != sb->s_feature_incompat))
382 ext2fs_mark_super_dirty(fs);
386 * Add a journal to the filesystem.
388 static void add_journal(ext2_filsys fs)
390 unsigned long journal_blocks;
395 if (fs->super->s_feature_compat &
396 EXT3_FEATURE_COMPAT_HAS_JOURNAL) {
397 fputs(_("The filesystem already has a journal.\n"), stderr);
400 if (journal_device) {
401 check_plausibility(journal_device);
402 check_mount(journal_device, 0, _("journal"));
403 #ifdef CONFIG_TESTIO_DEBUG
404 io_ptr = test_io_manager;
405 test_io_backing_manager = unix_io_manager;
407 io_ptr = unix_io_manager;
409 retval = ext2fs_open(journal_device, EXT2_FLAG_RW|
410 EXT2_FLAG_JOURNAL_DEV_OK, 0,
411 fs->blocksize, io_ptr, &jfs);
413 com_err(program_name, retval,
414 _("\n\twhile trying to open journal on %s\n"),
418 printf(_("Creating journal on device %s: "),
422 retval = ext2fs_add_journal_device(fs, jfs);
425 com_err (program_name, retval,
426 _("while adding filesystem to journal on %s"),
430 fputs(_("done\n"), stdout);
431 } else if (journal_size) {
432 fputs(_("Creating journal inode: "), stdout);
434 journal_blocks = figure_journal_size(journal_size, fs);
436 retval = ext2fs_add_journal_inode(fs, journal_blocks,
439 fprintf(stderr, "\n");
440 com_err(program_name, retval,
441 _("\n\twhile trying to create journal file"));
444 fputs(_("done\n"), stdout);
446 * If the filesystem wasn't mounted, we need to force
447 * the block group descriptors out.
449 if ((mount_flags & EXT2_MF_MOUNTED) == 0)
450 fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
452 print_check_message(fs);
457 free(journal_device);
462 static void parse_e2label_options(int argc, char ** argv)
464 if ((argc < 2) || (argc > 3)) {
465 fputs(_("Usage: e2label device [newlabel]\n"), stderr);
468 io_options = strchr(argv[1], '?');
471 device_name = blkid_get_devname(NULL, argv[1], NULL);
473 com_err("e2label", 0, _("Unable to resolve '%s'"),
478 open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK;
485 static time_t parse_time(char *str)
489 if (strcmp(str, "now") == 0) {
492 memset(&ts, 0, sizeof(ts));
494 strptime(str, "%Y%m%d%H%M%S", &ts);
496 sscanf(str, "%4d%2d%2d%2d%2d%2d", &ts.tm_year, &ts.tm_mon,
497 &ts.tm_mday, &ts.tm_hour, &ts.tm_min, &ts.tm_sec);
500 if (ts.tm_year < 0 || ts.tm_mon < 0 || ts.tm_mon > 11 ||
501 ts.tm_mday < 0 || ts.tm_mday > 31 || ts.tm_hour > 23 ||
502 ts.tm_min > 59 || ts.tm_sec > 61)
505 if (ts.tm_mday == 0) {
506 com_err(program_name, 0,
507 _("Couldn't parse date/time specifier: %s"),
511 return (mktime(&ts));
514 static void parse_tune2fs_options(int argc, char **argv)
521 printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
522 while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:J:L:M:O:T:U:")) != EOF)
526 max_mount_count = strtol (optarg, &tmp, 0);
527 if (*tmp || max_mount_count > 16000) {
528 com_err (program_name, 0,
529 _("bad mounts count - %s"),
533 if (max_mount_count == 0)
534 max_mount_count = -1;
536 open_flag = EXT2_FLAG_RW;
539 mount_count = strtoul (optarg, &tmp, 0);
540 if (*tmp || mount_count > 16000) {
541 com_err (program_name, 0,
542 _("bad mounts count - %s"),
547 open_flag = EXT2_FLAG_RW;
550 if (strcmp (optarg, "continue") == 0)
551 errors = EXT2_ERRORS_CONTINUE;
552 else if (strcmp (optarg, "remount-ro") == 0)
553 errors = EXT2_ERRORS_RO;
554 else if (strcmp (optarg, "panic") == 0)
555 errors = EXT2_ERRORS_PANIC;
557 com_err (program_name, 0,
558 _("bad error behavior - %s"),
563 open_flag = EXT2_FLAG_RW;
565 case 'f': /* Force */
569 resgid = strtoul (optarg, &tmp, 0);
571 gr = getgrnam (optarg);
580 com_err (program_name, 0,
581 _("bad gid/group name - %s"),
586 open_flag = EXT2_FLAG_RW;
589 interval = strtoul (optarg, &tmp, 0);
602 case 'M': /* months! */
603 interval *= 86400 * 30;
607 case 'W': /* weeks */
608 interval *= 86400 * 7;
613 com_err (program_name, 0,
614 _("bad interval - %s"), optarg);
618 open_flag = EXT2_FLAG_RW;
623 open_flag = EXT2_FLAG_RW;
626 parse_journal_opts(optarg);
627 open_flag = EXT2_FLAG_RW;
635 open_flag = EXT2_FLAG_RW |
636 EXT2_FLAG_JOURNAL_DEV_OK;
639 reserved_ratio = strtod(optarg, &tmp);
640 if (*tmp || reserved_ratio > 50) {
641 com_err (program_name, 0,
642 _("bad reserved block ratio - %s"),
647 open_flag = EXT2_FLAG_RW;
650 new_last_mounted = optarg;
652 open_flag = EXT2_FLAG_RW;
656 com_err (program_name, 0,
657 _("-o may only be specified once"));
660 mntopts_cmd = optarg;
661 open_flag = EXT2_FLAG_RW;
666 com_err (program_name, 0,
667 _("-O may only be specified once"));
670 features_cmd = optarg;
671 open_flag = EXT2_FLAG_RW;
674 reserved_blocks = strtoul (optarg, &tmp, 0);
676 com_err (program_name, 0,
677 _("bad reserved blocks count - %s"),
682 open_flag = EXT2_FLAG_RW;
685 s_flag = atoi(optarg);
686 open_flag = EXT2_FLAG_RW;
690 last_check_time = parse_time(optarg);
691 open_flag = EXT2_FLAG_RW;
694 resuid = strtoul (optarg, &tmp, 0);
696 pw = getpwnam (optarg);
705 com_err (program_name, 0,
706 _("bad uid/user name - %s"),
711 open_flag = EXT2_FLAG_RW;
716 open_flag = EXT2_FLAG_RW |
717 EXT2_FLAG_JOURNAL_DEV_OK;
722 if (optind < argc - 1 || optind == argc)
724 if (!open_flag && !l_flag)
726 io_options = strchr(argv[optind], '?');
729 device_name = blkid_get_devname(NULL, argv[optind], NULL);
731 com_err("tune2fs", 0, _("Unable to resolve '%s'"),
737 void do_findfs(int argc, char **argv)
742 (strncmp(argv[1], "LABEL=", 6) && strncmp(argv[1], "UUID=", 5))) {
743 fprintf(stderr, "Usage: findfs LABEL=<label>|UUID=<uuid>\n");
746 dev = blkid_get_devname(NULL, argv[1], NULL);
748 com_err("findfs", 0, _("Unable to resolve '%s'"),
757 int main (int argc, char ** argv)
761 struct ext2_super_block *sb;
765 setlocale(LC_MESSAGES, "");
766 setlocale(LC_CTYPE, "");
767 bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
768 textdomain(NLS_CAT_NAME);
771 program_name = *argv;
772 add_error_table(&et_ext2_error_table);
774 if (strcmp(get_progname(argv[0]), "findfs") == 0)
775 do_findfs(argc, argv);
776 if (strcmp(get_progname(argv[0]), "e2label") == 0)
777 parse_e2label_options(argc, argv);
779 parse_tune2fs_options(argc, argv);
781 #ifdef CONFIG_TESTIO_DEBUG
782 io_ptr = test_io_manager;
783 test_io_backing_manager = unix_io_manager;
785 io_ptr = unix_io_manager;
787 retval = ext2fs_open2(device_name, io_options, open_flag,
790 com_err (program_name, retval, _("while trying to open %s"),
793 _("Couldn't find valid filesystem superblock.\n"));
797 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
799 /* For e2label emulation */
800 printf("%.*s\n", (int) sizeof(sb->s_volume_name),
802 remove_error_table(&et_ext2_error_table);
805 retval = ext2fs_check_if_mounted(device_name, &mount_flags);
807 com_err("ext2fs_check_if_mount", retval,
808 _("while determining whether %s is mounted."),
812 /* Normally we only need to write out the superblock */
813 fs->flags |= EXT2_FLAG_SUPER_ONLY;
816 sb->s_max_mnt_count = max_mount_count;
817 ext2fs_mark_super_dirty(fs);
818 printf (_("Setting maximal mount count to %d\n"),
822 sb->s_mnt_count = mount_count;
823 ext2fs_mark_super_dirty(fs);
824 printf (_("Setting current mount count to %d\n"), mount_count);
827 sb->s_errors = errors;
828 ext2fs_mark_super_dirty(fs);
829 printf (_("Setting error behavior to %d\n"), errors);
832 sb->s_def_resgid = resgid;
833 ext2fs_mark_super_dirty(fs);
834 printf (_("Setting reserved blocks gid to %lu\n"), resgid);
837 sb->s_checkinterval = interval;
838 ext2fs_mark_super_dirty(fs);
839 printf (_("Setting interval between checks to %lu seconds\n"), interval);
842 sb->s_r_blocks_count = e2p_percent(reserved_ratio,
844 ext2fs_mark_super_dirty(fs);
845 printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"),
846 reserved_ratio, sb->s_r_blocks_count);
849 if (reserved_blocks >= sb->s_blocks_count/2) {
850 com_err (program_name, 0,
851 _("reserved blocks count is too big (%lu)"),
855 sb->s_r_blocks_count = reserved_blocks;
856 ext2fs_mark_super_dirty(fs);
857 printf (_("Setting reserved blocks count to %lu\n"),
861 if (sb->s_feature_ro_compat &
862 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)
863 fputs(_("\nThe filesystem already has sparse "
864 "superblocks.\n"), stderr);
866 sb->s_feature_ro_compat |=
867 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
868 sb->s_state &= ~EXT2_VALID_FS;
869 ext2fs_mark_super_dirty(fs);
870 printf(_("\nSparse superblock flag set. %s"),
875 if (!(sb->s_feature_ro_compat &
876 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
877 fputs(_("\nThe filesystem already has sparse "
878 "superblocks disabled.\n"), stderr);
880 sb->s_feature_ro_compat &=
881 ~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
882 sb->s_state &= ~EXT2_VALID_FS;
883 fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
884 ext2fs_mark_super_dirty(fs);
885 printf(_("\nSparse superblock flag cleared. %s"),
890 sb->s_lastcheck = last_check_time;
891 ext2fs_mark_super_dirty(fs);
892 printf(_("Setting time filesystem last checked to %s\n"),
893 ctime(&last_check_time));
896 sb->s_def_resuid = resuid;
897 ext2fs_mark_super_dirty(fs);
898 printf (_("Setting reserved blocks uid to %lu\n"), resuid);
901 if (strlen(new_label) > sizeof(sb->s_volume_name))
902 fputs(_("Warning: label too long, truncating.\n"),
904 memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name));
905 strncpy(sb->s_volume_name, new_label,
906 sizeof(sb->s_volume_name));
907 ext2fs_mark_super_dirty(fs);
910 memset(sb->s_last_mounted, 0, sizeof(sb->s_last_mounted));
911 strncpy(sb->s_last_mounted, new_last_mounted,
912 sizeof(sb->s_last_mounted));
913 ext2fs_mark_super_dirty(fs);
916 update_mntopts(fs, mntopts_cmd);
918 update_feature_set(fs, features_cmd);
919 if (journal_size || journal_device)
923 if ((strcasecmp(new_UUID, "null") == 0) ||
924 (strcasecmp(new_UUID, "clear") == 0)) {
925 uuid_clear(sb->s_uuid);
926 } else if (strcasecmp(new_UUID, "time") == 0) {
927 uuid_generate_time(sb->s_uuid);
928 } else if (strcasecmp(new_UUID, "random") == 0) {
929 uuid_generate(sb->s_uuid);
930 } else if (uuid_parse(new_UUID, sb->s_uuid)) {
931 com_err(program_name, 0, _("Invalid UUID format\n"));
934 ext2fs_mark_super_dirty(fs);
939 remove_error_table(&et_ext2_error_table);
940 return (ext2fs_close (fs) ? 1 : 0);