Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Add cmd param #29

Merged
merged 3 commits into from
Dec 18, 2015
Merged

Add cmd param #29

merged 3 commits into from
Dec 18, 2015

Conversation

petems
Copy link
Owner

@petems petems commented Nov 12, 2015

Added cmd parameter …

  • Defaults to dd but allows for the use of fallocate for performance.
  • Added cmd option to spec file.
  • Added new cmd parameter to readme

@petems petems force-pushed the add_cmd_param branch 2 times, most recently from 4860ee2 to 08112a6 Compare November 12, 2015 20:13
BIAndrews and others added 2 commits November 12, 2015 20:15
* Defaults to dd but allows for the use of fallocate for performance.
* Added cmd option to spec file.
* Added new cmd parameter to readme
DRY up a lot of the Puppet code
@petems
Copy link
Owner Author

petems commented Nov 12, 2015

@BIAndrews I'm just running some acceptance tests on this and I'm getting failures:

 swap_file::files { 'default':
   ensure   => present,
   cmd      => 'fallocate',
 }
Notice: /Stage[main]/Main/Swap_file::Files[default]/Exec[Attach swap file /mnt/swap.1]/returns: Setting up swapspace version 1, size = 1067004 KiB
Notice: /Stage[main]/Main/Swap_file::Files[default]/Exec[Attach swap file /mnt/swap.1]/returns: no label, UUID=1de0229e-973d-4ccb-87f0-c3b3d972fb66
Notice: /Stage[main]/Main/Swap_file::Files[default]/Exec[Attach swap file /mnt/swap.1]/returns: swapon: /mnt/swap.1: swapon failed: Invalid argument

Works fine with dd. Is there something else we need to do to the file with fallocate before we run swapon?

@BIAndrews
Copy link
Contributor

On your system is /mnt/ XFS?

@BIAndrews
Copy link
Contributor

I just manually tested it on a CentOS6 server with ext4 and it worked ok. I saw a note on the arch linux swap wiki page about XFS and fallocate problems. XFS is now the default for CentOS7 (yay!) but fallocate and XFS don't play well together (boo!)

# fallocate -l 512M /mnt/swap.test
# ls -lah /mnt/swap.test
-rw-r--r-- 1 root root 512M Nov 12 13:43 /mnt/swap.test
# mkswap /mnt/swap.test
# swapon /mnt/swap.test
# swapon -s
Filename                                Type            Size    Used    Priority
/mnt/swap.test                          file            524284  0       -1
# cat /etc/redhat-release 
CentOS release 6.7 (Final)
# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sdb1 on /tank type xfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

XFS FAILS:

# fallocate -l 512M /tank/swap.test
# mkswap /tank/swap.test
mkswap: /tank/swap.test: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=5702bbae-b712-4f24-8066-1e35c7b8ed45
# echo $?
0
# swapon /tank/swap.test
swapon: /tank/swap.test: swapon failed: Invalid argument
# mount | grep tank
/dev/sdb1 on /tank type xfs (rw)

@petems
Copy link
Owner Author

petems commented Nov 12, 2015

@BIAndrews Ah, yes I'm running this test on a Centos 7 vagrant machine. Good spot!

Hmm, we should probably put a warning/fail if filesystem is XFS when picking fallocate. Let me whip something up...

@petems
Copy link
Owner Author

petems commented Nov 12, 2015

Weird it's marked as "not a bug" here: https://bugzilla.redhat.com/show_bug.cgi?id=1129205

I'm wondering whether to do a bunch of checking kernel and filesystem stuff, or just add a puppet warning for the fallocate command and allow buyer beware...

petems added a commit that referenced this pull request Dec 18, 2015
@petems petems merged commit 5160afb into master Dec 18, 2015
@petems petems deleted the add_cmd_param branch February 15, 2016 16:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants