From 13f260574f00710cfaf231ac5afac4484fef9511 Mon Sep 17 00:00:00 2001 From: Minoru Kobayashi Date: Mon, 5 Aug 2024 17:14:34 +0900 Subject: [PATCH 1/3] artif: new Btrfs artifacts Add new artifacts to collect information of Btrfs subvolumes. --- artifacts/live_response/storage/btrfs.yaml | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 artifacts/live_response/storage/btrfs.yaml diff --git a/artifacts/live_response/storage/btrfs.yaml b/artifacts/live_response/storage/btrfs.yaml new file mode 100644 index 00000000..501c6ffe --- /dev/null +++ b/artifacts/live_response/storage/btrfs.yaml @@ -0,0 +1,54 @@ +version: 1.0 +condition: command_exists "btrfs" +output_directory: /live_response/storage +artifacts: + - + description: Collect the list of all Btrfs mountpoints. + supported_os: [linux] + collector: command + command: mount | grep btrfs | awk '{print $3}' + output_directory: /%temp_directory%/storage + output_file: list_of_btrfs_mountpoints.txt + - + description: List all subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R.txt + - + description: List only snapshot subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -s %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-s.txt + - + description: List only readonly subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -r %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-r.txt + - + description: List deleted subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -d %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-d.txt + # - + # description: Collect the list of all Btrfs subvolumes. + # supported_os: [linux] + # collector: command + # foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + # command: btrfs subvolume list -a %line% | grep -v '' | awk -v mp="%line%/" 'NF{print mp$NF; found=1} END{if (!found) print mp}' + # output_directory: /%temp_directory%/storage + # output_file: list_of_btrfs_subvolumes.txt + - + description: Show information about mounted Btrfs subvolumes. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume show %line% + output_file: btrfs_subvolumes_show.txt From d171c4f7fbdbcd7fc3c819926b12177eb4db4887 Mon Sep 17 00:00:00 2001 From: Minoru Kobayashi Date: Fri, 9 Aug 2024 16:36:40 +0900 Subject: [PATCH 2/3] artif: changed line feed in btrfs.yaml Changed line feed code from CRLF to LF. --- artifacts/live_response/storage/btrfs.yaml | 108 ++++++++++----------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/artifacts/live_response/storage/btrfs.yaml b/artifacts/live_response/storage/btrfs.yaml index 501c6ffe..4ed81b17 100644 --- a/artifacts/live_response/storage/btrfs.yaml +++ b/artifacts/live_response/storage/btrfs.yaml @@ -1,54 +1,54 @@ -version: 1.0 -condition: command_exists "btrfs" -output_directory: /live_response/storage -artifacts: - - - description: Collect the list of all Btrfs mountpoints. - supported_os: [linux] - collector: command - command: mount | grep btrfs | awk '{print $3}' - output_directory: /%temp_directory%/storage - output_file: list_of_btrfs_mountpoints.txt - - - description: List all subvolumes of mounted Btrfs filesystems. - supported_os: [linux] - collector: command - foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - command: btrfs subvolume list -a -p -c -u -q -R %line% - output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R.txt - - - description: List only snapshot subvolumes of mounted Btrfs filesystems. - supported_os: [linux] - collector: command - foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - command: btrfs subvolume list -a -p -c -u -q -R -s %line% - output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-s.txt - - - description: List only readonly subvolumes of mounted Btrfs filesystems. - supported_os: [linux] - collector: command - foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - command: btrfs subvolume list -a -p -c -u -q -R -r %line% - output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-r.txt - - - description: List deleted subvolumes of mounted Btrfs filesystems. - supported_os: [linux] - collector: command - foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - command: btrfs subvolume list -a -p -c -u -q -R -d %line% - output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-d.txt - # - - # description: Collect the list of all Btrfs subvolumes. - # supported_os: [linux] - # collector: command - # foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - # command: btrfs subvolume list -a %line% | grep -v '' | awk -v mp="%line%/" 'NF{print mp$NF; found=1} END{if (!found) print mp}' - # output_directory: /%temp_directory%/storage - # output_file: list_of_btrfs_subvolumes.txt - - - description: Show information about mounted Btrfs subvolumes. - supported_os: [linux] - collector: command - foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" - command: btrfs subvolume show %line% - output_file: btrfs_subvolumes_show.txt +version: 1.0 +condition: command_exists "btrfs" +output_directory: /live_response/storage +artifacts: + - + description: Collect the list of all Btrfs mountpoints. + supported_os: [linux] + collector: command + command: mount | grep btrfs | awk '{print $3}' + output_directory: /%temp_directory%/storage + output_file: list_of_btrfs_mountpoints.txt + - + description: List all subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R.txt + - + description: List only snapshot subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -s %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-s.txt + - + description: List only readonly subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -r %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-r.txt + - + description: List deleted subvolumes of mounted Btrfs filesystems. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume list -a -p -c -u -q -R -d %line% + output_file: btrfs_subvolumes_list_-a_-p_-c_-u_-q_-R_-d.txt + # - + # description: Collect the list of all Btrfs subvolumes. + # supported_os: [linux] + # collector: command + # foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + # command: btrfs subvolume list -a %line% | grep -v '' | awk -v mp="%line%/" 'NF{print mp$NF; found=1} END{if (!found) print mp}' + # output_directory: /%temp_directory%/storage + # output_file: list_of_btrfs_subvolumes.txt + - + description: Show information about mounted Btrfs subvolumes. + supported_os: [linux] + collector: command + foreach: cat "/%temp_directory%/storage/list_of_btrfs_mountpoints.txt" + command: btrfs subvolume show %line% + output_file: btrfs_subvolumes_show.txt From 854b65116dde4dc9262709e08c9a5dde7dd1e2fc Mon Sep 17 00:00:00 2001 From: Minoru Kobayashi Date: Fri, 23 Aug 2024 16:26:15 +0900 Subject: [PATCH 3/3] artif: use "mount -t" instead of "grep" --- artifacts/live_response/storage/btrfs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/live_response/storage/btrfs.yaml b/artifacts/live_response/storage/btrfs.yaml index 4ed81b17..382537cd 100644 --- a/artifacts/live_response/storage/btrfs.yaml +++ b/artifacts/live_response/storage/btrfs.yaml @@ -6,7 +6,7 @@ artifacts: description: Collect the list of all Btrfs mountpoints. supported_os: [linux] collector: command - command: mount | grep btrfs | awk '{print $3}' + command: mount -t btrfs | awk '{print $3}' output_directory: /%temp_directory%/storage output_file: list_of_btrfs_mountpoints.txt -