We have a sysadmin configure a couple of servers at digitalocean. To me, it looks like swap wasn't enabled on this but it's been a VERY long time since I've had to do things like this. It's a rails app and the only reason this came up is because we were getting out of memory errors. Is a swap partition still considered a best practice for a modern (3.2.13 rails app)? I'd imagine so. Is there a simple fix to creating a swap partition from the command line (host has 2GB of RAM)? Not asking to do it but some guidance would be appreciated.
I'm fine with just upgrading to a 1GB of memory server which is only $5 / month more.
deploy@x1:~$ sudo fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track,
5221 cylinders, total 83886080 sectors Units = sectors of 1 * 512 =
512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O
size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
Disk /dev/sda doesn't contain a valid partition table
deploy@x1:~$
Alos should I be concerned about the last line regarding not containing a valid partition table?
You can always check if swap is enabled by running:
swapon -s
(See man swapon
for details.)
This lists all swaps that are currently enabled. If you run that and get no output, swap is not enabled. Most of the time an Ubuntu system will have a single swap partition and no swap files enabled; that will look something like this:
ek@Kip:~$ swapon -s
Filename Type Size Used Priority
/dev/sda7 partition 4194300 1499712 -1
As for sudo fdisk -l
telling you that Disk /dev/sda doesn't contain a valid partition table
: no, that is usually not cause for concern. (In particular, it doesn't mean no swap is enabled.)
fdisk
doesn't support some constructs--it will not recognize a disk that use LVM or software RAID (md) as having a valid partition table. LVM is very common on servers. When you see this warning from fdisk -l
, run parted -l
instead:
sudo parted -l
parted
is more likely to be able to identify and report on such constructs.
No comments:
Post a Comment