这方面我是新的,我正试图找出什么是最好的方式来进行这方面的工作。我有一个系统,我需要增加它的交换文件,我意识到交换分区不是lvm,所以有点过时。但是,我当前的交换分区是8Gb,但需要达到16 8Gb。
# swapon -s
Filename Type Size Used Priority
/swapfile file 8191996 6341008 -1我想我的问题是它是一个交换文件,而不是一个分区(至少对我来说是一个问题:(.)我可以在网上阅读,我可以使用dd创建一个swapfile,但我不知道如何实际增加大小,或者是否需要创建一个新的分区。
/etc/fstab如下所示:
/swapfile swap swap defaults 0 0对如何进行有任何建议吗?
发布于 2017-01-04 15:16:18
如上所述,您可以调整swapfile的大小以获得所需的效果。但是我建议添加另一个具有相同优先级的swapfile,这样就不需要交换GB的交换数据了。
# Create another swapfile, mind the filename!
sudo dd if=/dev/zero of=/swapfile2 bs=1M count=8192
# Make the new file a swapfile
sudo mkswap /swapfile2
# Enable it
sudo swapon /swapfile2
# Change its priority
sudo swapon /swapfile2 -p -1 # Or anything you want然后将/swapfile2 swap swap defaults 0 0添加到/etc/fstab中。
发布于 2017-01-04 14:55:19
swapfile实际上就是一个用于交换的实际文件。有几种方法可以做到这一点,最好是删除它并创建一个新的。
# this disables ALL swap, you can target with swapoff /swapfile
sudo swapoff -a
# delete old swap file
sudo rm /swapfile
# create new swap file. dd takes /dev/zero which always returns.. 0 then it
# writes that data into the file under 'of'. So it is just a file full of 0s
# bs is blocksize and count is number of blocks, so bs=1M and count=16284
# will create a 16284 MByte file. Adjust count to make a bigger file.
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
# make file a swapfile
sudo mkswap /swapfile
# enable swapfile
sudo swapon /swapfile
# you already have swapfile of the same name in fstab, so no need to edit ithttps://serverfault.com/questions/824120
复制相似问题