Skip to content
Snippets Groups Projects

Fix mount hdd ext4

Merged Pullyvan Krishnamoorthy requested to merge fixMountHDDExt4 into master
2 files
+ 37
76
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 18
40
@@ -14,52 +14,30 @@
- parted.x86_64
- parted-devel.x86_64
- name: Unmount a mounted volume
- name: Unmount a mounted /home
ansible.posix.mount:
path: /home
state: unmounted
ignore_errors: yes
- name: Create a new partition on hdd2
become: yes
parted:
name: home
part_type: primary
label: gpt
number: 1
device: /dev/nvme0n1
state: present
ignore_errors: yes
- name: Get System Details
stat: path={{ dev }}
register: check_mount
when: hdd2.stat.exists == False
- name: Check the type of filesystem if its data we need to format
shell: file -s {{ dev }}
register: fs
when: hdd2.stat.exists == False
- name: setting facts
set_fact:
format_fs: true
when: "'{{ dev }}: data' in fs.stdout"
- name: Format a ext4 filesystem on {{ dev }}
- name: Create a ext4 filesystem on /dev/nvme0n1
community.general.filesystem:
fstype: "{{ fstype }}"
dev: "{{ dev }}"
fstype: ext4
dev: /dev/nvme0n1
force: yes
- name: Mount filesystem
- name: Mount up device by /dev/nvme0n1 on /home in fstab
mount:
fstype: "{{ fstype }}"
src: "{{ dev }}"
name: "{{ mount }}"
opts: "{{ opts }}"
state: "{{ state }}"
register: mount_info
path: /home
src: /dev/nvme0n1
fstype: ext4
state: present
- name: Remount a mounted volume /home
ansible.posix.mount:
path: /home
src: /dev/nvme0n1
fstype: ext4
state: mounted
Loading