Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swap zeroing leads to fstab pointing to non-existent swap UUID #8

Closed
javornikolov opened this issue Dec 26, 2013 · 4 comments
Closed
Labels

Comments

@javornikolov
Copy link
Contributor

Current approach of zeroing the swap partition is problematic:
https://github.com/2creatives/vagrant-centos/blob/master/ks.cfg#L221

The result is something like that:

$ sudo swapon -s
Filename                Type        Size    Used    Priority

The problem is that fstab contains the UUID of this partition (not device name or something else). And that UUID is destroyed by dd and re-generated by mkswap.

I can imagine two options to handle that:
a) Use seek parameter of dd to skip zeroing the header of the partition. And do not perform mkswap after that.
b) Save the original UUID before the maintenance and then re-use it in mkswap. (Or alternatively - change the UUID in fstab). I think UUID can be extracted with blkid or listing /dev/disk/by-uuid.

Another problem is that dd is executed with default block size which is terribly slow. It should be changed to e.g. 1MB. E.g.:
dd if=/dev/zero of=/dev/sdb1 bs=1024k seek=1

Another remark: maybe would be easier to manage the zeroing of free space and other operations too if using separate disk for swap. Also /boot partition is usually handy to have it in separate partition (in case of VM - easier to do that as separate disk).

@casr
Copy link
Member

casr commented Dec 27, 2013

Thanks for the report! These are all very useful suggestions and the lack of swap is a pretty major oversight.

Also /boot partition is usually handy to have it in separate partition (in case of VM - easier to do that as separate disk).

I'm curious about this. It does seem sensible but how have you found it handy?

@javornikolov
Copy link
Contributor Author

Also /boot partition is usually handy to have it in separate partition (in case of VM - easier to do that as separate disk).

I'm curious about this. It does seem sensible but how have you found it handy?

Maybe my bias comes from non-vm physical machines. With separate boot It's easier to change the file system or use LVM. One thing in my mind was eventually switching to btrfs file system (since it supports compression).

casr added a commit that referenced this issue Jan 4, 2014
dd has a low block size that causes the operation to go slower than
it needs to. Relates to GH-8
casr added a commit that referenced this issue Jan 4, 2014
The UUID is contained on the space that was cleared so CentOS didn't
know how to handle the parition from fstab on the reboot. GH-8
casr added a commit that referenced this issue Jan 4, 2014
casr added a commit that referenced this issue Jan 4, 2014
@casr
Copy link
Member

casr commented Jan 4, 2014

I've opted to raise the swap size as per recommendations over at https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s2-diskpartrecommend-ppc.html

I'm not going to put the /boot on a separate partition as it seems to complicate the setup without a much benefit. I can see it's use on less transient machines though so thanks for the tip!

@casr
Copy link
Member

casr commented Jan 5, 2014

Thanks once again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants