As a recent cost saving measure I downgraded my Linode to the Nanode plan. I was actually only using around 25GB of the 50GB disk I had available anyway on the previous plan, it’s just that I had it spread out over three 10GB partitions (/home
, /usr
, /
) and then I kept another couple of disks for a NetBSD install image and a scratch disk I could use when in rescue mode (so I could download a new NetBSD image and extract it for copying to the install disk).
I.e. day to day I could easily fit in 25GB… I just needed the extra for upgrades. Now Linode have block storage (they’ve had it for ages… I move slowly) I can add a volume or two just for when I need to upgrade stuff and then remove it afterwards. That’s my plan anyway.
Memory-wise I was also sitting within 1GB of RAM. The most memory intensive thing I ran was the Keybase client for, very rarely, chatting to people. I can just not use it and I should be fine with only 1GB RAM.
To scale down I needed to get my 10GB root partition down to a 5GB disk. You can’t scale down raw disk images on Linode so I roughed out a plan in my head for doing this along the lines of:
- Add new, smaller 5GB disk for root (since I had enough spare on the larger plan)
- Also add a new, temporary, disk to dump to
- Reboot in single user. Don’t mount
/usr
and/home
- Dump old root to the temp disk, e.g:
dump -0af /dump/root.dump /
- Restore dump to new root disk, e.g:
cd /newroot; restore -rf /backup/root.dump
- Adjust Linode config to boot off the new root disk and reboot to check it works
- Shutdown Linode
- Remove all other Linode disks so I’m within 25GB
- Resize
- Restart
It didn’t quite work. I forgot / realised too late simply dumping and restoring root would not result in a bootable disk (maybe it would if I was better with disklabel
) so I had to tweak things a bit. I’d also glossed over the details of setting up new disks so somewhere in the middle of the above I also did:
- Create a Linode configuration that boots my NetBSD install image, but also has the new 5GB disk attached
- Install NetBSD to this new 5GB disk (which also made adding swap easier)
- Reboot again with old root in single user mode with new 5GB disk attached
- Mount root as read/write so I could do stuff:
mount -u /
- Partition dump disk
disklabel -i -I wdX
, etc - Add filesystem:
newfs /dev/wdXa
mkdir /dump
andmount /dev/wdXa /dump
- Dump out old root
- Mount new root and delete everything under it
- Restore the dump of old root in that mount
- Reboot a config using the new root to check it all works
It wasn’t too stressful in the end and worked pretty well. I messed up my bootblocks again and only have Glish working right now, but will fix that again at a later (upgrade) date.
When I started on Linode, and had less money than I have now, I was paying $20 a month; Probably the exchange rate was pretty good then though. I’ve been at the $10 plan for years. Seems crazy I’m now on the $5 plan. But it’ll all help with the cost of running shoes… I could do with two new pairs already.