2

With lvs I get the default output:

~$ sudo lvs
  LV                     VG       Attr       LSize  Pool Origin  Data%  Meta%  Move Log Cpy%Sync Convert
  pre_upgrade_2020-10-31 rpi.vg06 swi-a-s---  2,19g      root.lv 64,37
  pre_upgrade_2020-12-02 rpi.vg06 swi-a-s--- <2,20g      root.lv 0,02
  root.lv                rpi.vg06 owi-aos---  3,00g

But that's not what interests me most. I want to get:

~$ sudo lvs -o lv_full_name,lv_attr,origin,lv_size,seg_size_pe,data_percent,lv_time -O lv_time
  LV                              Attr       Origin  LSize  SSize Data%  CTime
  rpi.vg06/root.lv                owi-aos---          3,00g   768        2020-04-05 22:34:46 +0200
  rpi.vg06/pre_upgrade_2020-10-31 swi-a-s--- root.lv  2,19g   561 64,37  2020-10-31 20:52:45 +0100
  rpi.vg06/pre_upgrade_2020-12-02 swi-a-s--- root.lv <2,20g   562 0,02   2020-12-02 23:15:47 +0100

The command is a bit long and not good to remember. I tried to use an alias but sudo doesn't know the users alias. Is there a way to configure lvs to output this by default with sudo lvs? Maybe in a *.conf or *rc file?

1 Answer 1

3

Default lvs output can be changed in /etc/lvm/lvm.conf. Locate the report section and change lvs_cols value to columns you want to see in lvs output.

# Configuration section report.
# LVM report command output formatting.
# This configuration section has an automatic default value.
report {
...
        # Configuration option report/lvs_cols.
        # List of columns to report for 'lvs' command.
        # See 'lvs -o help' for the list of possible fields.
        # This configuration option has an automatic default value.
        lvs_cols = lv_full_name,lv_attr,origin,lv_size,seg_size_pe,data_percent,lv_time
...
}
$ sudo lvs
  LV          Attr       Origin LSize   SSize  Data%  CTime                     
  fedora/home -wi-ao----        852,64g 218277        2019-06-07 14:08:45 +0200 
  fedora/root -wi-ao----         69,98g  17916        2019-06-07 14:08:48 +0200 
  fedora/swap -wi-ao----          7,86g   2013        2019-06-07 14:08:45 +0200

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .