Debian – resize root ext3 partition on remote system – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, remote, ext3, rootfs, .
I want to resize (shrink) root ext3 fs partition of remote Debian 5.0 system. There is no LVM.
Is it possible without using a livecd? E.g. via custom initrd.img.
And second problem – Can I instuct grub to use different options only at first next reboot, but not at the second and subsequent.
It’s certainly possible; the only thing you need to shrink your root filesystem is another root filesystem to boot into.
I don’t know if a custom initrd.img will be sufficient. (It might be. I’d love to hear a way to do it.)
If it were me, I’d make a minimal system installation on another partition, containing only the necessary tools. You’d reboot into this partition and resize your primary root partition from there. (If you’re using a Debian-based distribution, the article Installing Linux from Linux describes a good method for doing this.)
If your system drive is full but you have a swap partition, you might temporarily repurpose it to be that secondary root partition. Since the secondary system only needs the base system, filesystem tools, and SSH, it can live on a very small partition. Your system can probably live without swap while you’re setting up for this procedure.
As for Grub, with Grub v1 you can use the Grub menu commands
default saved and
savedefault N with the commandline tool
grub-set-default to set a one-time-boot option. I wrote up a how-to for doing boot-once with Grub v1 in another answer.
The short version: setup your
default saved # boot entry 0 title Default boot root hd(0,0) kernel /boot/vmlinuz-2.6.xx UUID=xxxxxxx ro savedefault # boot entry 1 title Temp boot root hd(0,1) kernel /boot/vmlinuz UUID=yyyyyyyy ro savedefault 0
Grub will boot the “Default boot” entry by default, and if you want to reboot into the “Temp boot” entry you can run
grub-set-default 1 and reboot. The reboot will use the temporary default, boot the “Temp boot” entry, and save the “Default boot” entry as the next reboot.
I would expect you could put everything you need into your initrd, and then unmount root (I’d put everything you normally have in your initrd, plush the ssh or what ever for remote, + the fs etc tools), this way you don’t risk much.
The other thing is, what happens if you screw up? The added down time might make another plan a better choice, such as adding a disk to the system.