View Full Version : new partition/filesystem
I just signed up for a debian server, and am planning on migrating my existing colo stuff to it.
One of my main uses for the box is email. A few other users and I have big maildirs (on the order of 20-30k messages). ext[23] don't really deal well with a large directory full of a bunch of tiny files, so I'm planning on benchmarking performance on a local machine to see if I'd gain from using an alternate filesystem (reiserfs, xfs).
In light of this, my question is: has anybody repartitioned their disk and/or used an alternate filesystem on their serverbeach box?
The only solution I can cook up to do this is hacking something together where I put a custom rolled root filesystem on /boot that runs sshd, has e2resize, and fdisk on it. Edit the bootloader to point to it and reboot with my fingers crossed hoping it'll get online and start sshd. Then remotely shrink /, point the bootloader back to the original setup, and reboot to the full filesystem. Then I have a shrunken / and can create another partition/filesystem.
interesting...
I did a little bit of work on a similar project, using a modified knoppix (http://knoppix.net)
distribution. I've had my eye on a serverbeach box for months, back before they were offering debian boxes. I was hatching a plot to hook up with a redhat box, then use a knoppix image to repartition/reinstall debian onto it remotely.
It's still in a mostly theoretical state, but you can see what I've written up so far
here (http://asa.vu/~nato/remoteknoppix.html).
(The site this was originally on is in the middle of a DNS transfer at the moment, so I ripped the page above.)
Who knows, you may find the technique useful. I'd imagine that hardest part would be using parted or some other tool to resize a partition to put your knoppix image onto (obviously a 73Mb /boot just ain't gonna cut it)
Anyway, enough outta me. Hope this helps, or is at least entertaining.... ;p
knightfoo
2003-09-13, 10:38 AM
It might be safer to use your swap partition to do the intermediate installation. It is 1GB in size so you have plenty of room to work with. Of course I do not recommend doing any of this unless you *really* know how to work with a Debian system. You can use debootstrap (apt-get install debootstrap) to install a base Debian system then go from there. You might want to try this out on a local machine first to see how it works out. When I find some spare time, I plan on writing a HowTo for this.
-knightfoo
Good call on the swap partition.
I had a crazy scheme cooked up with busybox-static and parted statically compiled, but installing a mirror distro to the swap partition was much safer.
So, here's what I recall doing:
- reboot with swap commented out of /etc/fstab
- mkfs /dev/hda2
- mount /dev/hda2 /mnt/dest
- debootstrap woody /mnt/dest
- clone the following into /mnt/dest:
/etc/resolv.conf
/etc/network/interfaces
/etc/ssh/*
/etc/{passwd,shadow}
- edit /mnt/dest/etc/fstab for sanity
- edit /boot/grub/menu.lst to use root=/dev/hda2
reboot
- ssh in, su to r00t (had rootlogin disabled in sshd_config)
- ext2resize /dev/hda3 8G
- fdisk /dev/hda, del hda3, recreate it at start offset, end +8500M
reboot
- ssh in again
- ext2resize /dev/hda3 (this will grow the filesystem up to the part boundary)
- point grub back at /dev/hda3
reboot
restore swap partition, fdisk the free space, etc
Now I'm sporting a big fat xfs /home partition and some extra swap space (turned tmpfs).
knightfoo
2003-09-18, 22:45 PM
It's a few extra steps, but I bootstrapped the swap partition, booted into it, then wiped out the original / partition and bootstrapped that. Of course that only works if you don't mind toasting your data (i.e. brand new server). You can also just run "swapoff -a" to save yourself a reboot.
If you're *really* brave you can bootstrap your original, live / partition, install ssh, then clean up the RedHat cruft by comparing the files on the filesystem to the files in /var/lib/dpkg/*.list (I have some diff commands for this if anyone is interested).
-knightfoo
mcgroarty
2003-10-10, 08:36 AM
I think I've done something wrong -- I wonder if anyone can point at my folly?
I ran:
- swapoff -a
- fdisk to change hda2 to fs type 83 (Linux)
- mkfs.ext3 /dev/hda2
- mounted hda2 and cp -ax / onto the mount
- edit grub/menu.lst for / as hda2
- edit fstab on the mounted partition for / as hda2
reboot: doing fine, mount says root is now hda2
- fdisk to delete hda3 and create a new smaller partition
- mkfs.ext3 /dev/hda3
reboot to test: never came back
I'm a bit clueless about why it never came back. Was grub's bootsector installed on hda3 instead of boot or something?
knightfoo
2003-10-10, 08:46 AM
You probably should have rebooted after you modified the partition table but before you created a filesystem on it. The partition table can only be read once (during boot). If Linux and the BIOS have a different idea of what the partition table is then you will get all kinds of goofy problems. Aside from that, there could be a dozen other things that could go wrong with this procedure. :)
-knightfoo
mcgroarty
2003-10-10, 10:03 AM
Originally posted by knightfoo
You probably should have rebooted after you modified the partition table but before you created a filesystem on it.
Score one for knightfoo -- The admin folks brought the machine back up. There's no note on the ticket saying what they did and there weren't any file changes evident, but the new partition was indeed malformed -- its filesystem claimed to be larger than the actual partition size.
Redoing the fdisk, rebooting, and remaking the partition worked, so if the new kernel goes in cleanly (knock on wood), it's all safe package juggling from here on out.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.