parted
Repartitioning modern Linux systems without reboot
This one is for my own future reference as much as anything. Ever since the move to udev in Linux 2.6, I’ve found it neccesary to do the very un-Linux like thing of rebooting before the appropriate device appeared under /dev. This was only an occasional hassle but still, you shouldn’t need to reboot Linux for such a thing.
Thanks to Robert for his Google magic in turning up partprobe, part of the GNU Parted package. As the Debian man page for partprobe says
partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.
Excellent! Parted is normally installed on Debian and Ubuntu by default anyways, if not, simply, aptitude install parted and you’ll have access to the excellent partprobe.
We were trying to add some additional swap to a running system, the full series of commands needed as follows (I could have used parted to create the partition but the cfdisk tool has a nice interface),
- sudo cfdisk /dev/sda (and create new partition of type FD, Linux RAID)
- sudo cfdisk /dev/sdb (and create new partition of type FD, Linux RAID)
- sudo partprobe
- sudo mdadm –create /dev/md3 -n 2 -x 0 -l 1 /dev/sda4 /dev/sdb4 (our swap devices are software RAID1 devices)
- sudo /etc/init.d/udev restart (this updates /dev/disk/by-uuid/ with the new RAID device)
- sudo mkswap /dev/md3
- sudo vi /etc/fstab (and add a new entry for /dev/md3 as a swap device)
- sudo swapon -a (to activate the swap device)
- sudo swapon -s (to verify it is working)
Categories
Archives
- September 2010
- February 2010
- November 2009
- September 2009
- August 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- November 2007
- September 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- September 2006
- July 2006
- June 2006
- April 2006