mirror of
https://pagure.io/fedora-kickstarts.git
synced 2024-12-22 13:45:39 +00:00
Revert "Remove zeroing the disk, use fstrim+sync to trim the disk"
fstrim doesn't work at all in the image creation environment.
This reverts commit 8cad6efa4e
.
This commit is contained in:
parent
8cad6efa4e
commit
dc9b56098f
@ -121,6 +121,18 @@ releasever=$(rpm --eval '%{fedora}')
|
|||||||
basearch=$(uname -i)
|
basearch=$(uname -i)
|
||||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||||
|
|
||||||
|
echo "Zeroing out empty space."
|
||||||
|
# Create zeros file with nodatacow and no compression
|
||||||
|
touch /var/tmp/zeros
|
||||||
|
chattr +C /var/tmp/zeros
|
||||||
|
# This forces the filesystem to reclaim space from deleted files
|
||||||
|
dd bs=1M if=/dev/zero of=/var/tmp/zeros || :
|
||||||
|
echo "(Don't worry -- that out-of-space error was expected.)"
|
||||||
|
# Force sync to disk (Cf. https://pagure.io/cloud-sig/issue/340#comment-743430)
|
||||||
|
btrfs filesystem sync /
|
||||||
|
rm -f /var/tmp/zeros
|
||||||
|
btrfs filesystem sync /
|
||||||
|
|
||||||
# When we build the image a networking config file gets left behind.
|
# When we build the image a networking config file gets left behind.
|
||||||
# Let's clean it up.
|
# Let's clean it up.
|
||||||
echo "Cleanup leftover networking configuration"
|
echo "Cleanup leftover networking configuration"
|
||||||
@ -129,12 +141,8 @@ rm -f /etc/NetworkManager/system-connections/*.nmconnection
|
|||||||
# Clear machine-id on pre generated images
|
# Clear machine-id on pre generated images
|
||||||
truncate -s 0 /etc/machine-id
|
truncate -s 0 /etc/machine-id
|
||||||
|
|
||||||
# Use fstrim to trim the disk of unused blocks
|
# add fstrim -av to the post section until BZ#1971186 is resolved
|
||||||
# Cf. BZ#1971186
|
|
||||||
echo "Trimming the disk of unused blocks."
|
|
||||||
fstrim -av
|
fstrim -av
|
||||||
# Force sync to disk (Cf. https://pagure.io/cloud-sig/issue/340#comment-743430)
|
|
||||||
btrfs filesystem sync /
|
|
||||||
|
|
||||||
%end
|
%end
|
||||||
##### end kickstart post ############################################
|
##### end kickstart post ############################################
|
||||||
|
Loading…
Reference in New Issue
Block a user