"Accidentally" destroyed my filesystem

I was trying to delete and recreate a filesystem, thinking it would be a quick way of deleting all of the files off of it, and I fear that I messed up. Here is the original entry from /etc/filesystems:

data01:
        dev             = /dev/fslv00
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        options         = rw
        account         = false

And the output from df:

/dev/fslv00    133169152         0  100%  4639433    60% /data01

I first ran rmfs /data01 to delete the filesystem, then I tried the following:

[root@ibm: /]# mkfs -V jfs2 -o name=/data01 /dev/fslv00
mkfs: destroy /dev/fslv00 (yes)? y
mkfs: 0506-214: /dev/fslv00: A file or directory in the path name does not exist.

This didn't work so I tried crfs instead, but I don't think I was using that properly either:

[root@ibm: dev]# crfs -m /data01 -d /dev/fslv00 -v jfs2
0516-306 getlvodm: Unable to find  fslv00 in the Device
        Configuration Database.
/usr/sbin/getlvodm: A flag requires a parameter: y
Usage: /usr/sbin/getlvodm [-a LVdescript] [-B LVdescript] [-b LVid] [-c LVid]
        [-C] [-d VGdescript] [-e LVid] [-F] [-g PVid] [-h] [-j PVdescript]
        [-k] [-L VGdescript] [-l LVdescript] [-m LVid] [-p PVdescript]
        [-r LVid] [-s VGdescript] [-t VGid] [-u VGdescript] [-v VGdescript]
        [-w VGid] [-y LVid] [-G LVdescript]
crfs: 0506-923 Cannot get logical volume type from odm.

I am just trying to recreate my old /data01 filesystem with "normal" settings. The man pages for mkfs/crfs are a little confusing.. Any help would be appreciated.

The rmfs would have removed the logical volume (fslv00). Create it again, using mklv, then try creating the filesystem again with mkfs.

1 Like

Thank you Scott! I created a new logical volume from my volume group data01, like you said:

[root@ibm: dev]# mklv data01 65G
lv00
[root@ibm: dev]# lslv lv00
LOGICAL VOLUME:     lv00                   VOLUME GROUP:   data01
LV IDENTIFIER:      00c3e63a00004c000000013535af9d5f.3 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               jfs                    WRITE VERIFY:   off
MAX LPs:            520                    PP SIZE:        128 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                520                    PPs:            520
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO

Then I tried to create the new filesystem:

[root@ibm: dev]# mkfs -V jfs2 -o name=/data01 /dev/lv00
mkfs: destroy /dev/lv00 (yes)? y
File system created successfully.
68155156 kilobytes total disk space.
Device /dev/lv00:
  Standard empty filesystem
  Mount point:    /data01
  Size:           136310312 512-byte (DEVBLKSIZE) blocks

However when I ran df my new filesystem did not show up:

[root@ibm: /]# df
Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4       104857600  83368944   21%    11249     1% /
/dev/hd2         6815744    799104   89%    45470    33% /usr
/dev/hd9var      3407872   1133104   67%     8384     6% /var
/dev/hd3          262144      8624   97%      139     4% /tmp
/dev/fwdump       524288    523424    1%       19     1% /var/adm/ras/platform
/dev/hd1         1048576   1047616    1%        7     1% /home
/dev/hd11admin     262144    261384    1%        5     1% /admin
/proc                  -         -    -         -     -  /proc
/dev/hd10opt     2097152   1279616   39%    14927    10% /opt
/dev/livedump     524288    523552    1%        4     1% /var/adm/ras/livedump

Also my /etc/filesystems file does not have an entry for /data01.

Did I do something wrong? Was I supposed to set an auto-mount option or something?

When I look at the volume group information, my new logical volume shows up but it says N/A for mount point, was I supposed to do something when creating the new LV?

[root@ibm: /]# lsvg -l data01
data01:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
lvdata01            jfs        1       1       1    closed/syncd  N/A
loglv00             jfs2log    1       1       1    closed/syncd  N/A
lv00                jfs        520     520     1    closed/syncd  N/A

My AIX is very rusty! Perhaps you should have used crfs, actually, with the -A yes option to automount the filesystem. Still, no worries. You can just copy-paste the previous entry into /etc/filesystem, changing the LV name and any other details as appropriate, and then mount the filesystem manually.

/data01:
        dev             = /dev/lv00
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        options         = rw
        account         = false

(I added the /, as I assume it's missing)

It's not clear where lvdata01 came from. Did you just create that too?

If the filesystem /data01 is for database data, you might consider adding noatime to the options.

1 Like

Hm I'm not sure where lvdata01 came from either, and nope we won't be using this for database data :slight_smile:

Thank you so much for the help! I'm not super familiar with how filesystems are set up on AIX, and I wasn't sure if I was even allowed to modify /etc/filesystems but now everything is mounted properly. Cheers :smiley:

Sure, you can edit the file if you're careful. Normally commands like chfs, smit(ty), etc. would update it for you, but as the whole data01 stanza was missing, it's easier just to add it manually.