<commit_before>from __future__ import print_function

import os
import sys
import shutil

from sh import sudo, mount, df
from lvm2py import LVM
from sh import sfdisk, fsarchiver
from sh import pvs, lvcreate, lvremove, vgcfgbackup, pvdisplay

def metadata_backup(cfg):
    """ Back-up the LVM and other disk metadata, for this system
    """
    try:
        na, dev, device = cfg.metadata.split('/')
    except ValueError as e:
        print( "{}! cfg.metadata is {}".format(e, cfg.metadata) )
        return

    sfd_path = os.path.join(cfg.backup_path, device + '.sfd')
    sfdisk(d=cfg.metadata, _out=sfd_path)

    sfd_path_long = os.path.join(cfg.backup_path, device + '.sfd_long')
    sfdisk(l=cfg.metadata, _out=sfd_path_long)

    vgcfg = os.path.join(cfg.backup_path, 'lvm.conf')
    vgcfgbackup( f=vgcfg )

    shutil.copy('/etc/fstab', cfg.backup_path)   # backup 'fstab'

    pvs_out = os.path.join(cfg.backup_path, 'pvs_all.text')<commit_msg>fsa_lv_backup.py, metadata_backup(): fix 'vgcfgbackup' (path) for multiple VolGroups!<commit_after>from __future__ import print_function

import os
import sys
import shutil

from sh import sudo, mount, df
from lvm2py import LVM
from sh import sfdisk, fsarchiver
from sh import pvs, lvcreate, lvremove, vgcfgbackup, pvdisplay

def metadata_backup(cfg):
    """ Back-up the LVM and other disk metadata, for this system
    """
    try:
        na, dev, device = cfg.metadata.split('/')
    except ValueError as e:
        print( "{}! cfg.metadata is {}".format(e, cfg.metadata) )
        return

    sfd_path = os.path.join(cfg.backup_path, device + '.sfd')
    sfdisk(d=cfg.metadata, _out=sfd_path)

    sfd_path_long = os.path.join(cfg.backup_path, device + '.sfd_long')
    sfdisk(l=cfg.metadata, _out=sfd_path_long)

    vgcfg = os.path.join(cfg.backup_path, 'lvm_%s.conf')
    vgcfgbackup( f=vgcfg )

    shutil.copy('/etc/fstab', cfg.backup_path)   # backup 'fstab'

    pvs_out = os.path.join(cfg.backup_path, 'pvs_all.text')
{'fraction_non_alphanumeric': 0.12342569269521411, 'fraction_numerical': 0.0010075566750629723, 'mean_word_length': 3.6950354609929077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2921540', 'n_tokens_mistral': 731, 'n_tokens_neox': 711, 'n_words': 174}