本文共 3858 字,大约阅读时间需要 12 分钟。
ArchLinux下通过Grub2引导进入GPartedLive动态调整分区大小 版本: ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# cat /proc/version Linux version 3.7.9-2-ARCH (tobias@T-POWA-LX) (gcc version 4.7.2 (GCC) ) #1 SMP PREEMPT Mon Feb 25 12:04:25 CET 2013 ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 下载gparted live文件并解压,注意这里的boot是单独分区 (http://voxel.dl.sourceforge.net/project/gparted/gparted-live-stable/0.14.1-6/gparted-live-0.14.1-6-amd64.zip) unzip gparted-live-0.14.1-6-amd64.zip -d /boot/gpartedlive 调整分区列表,计划将根分区减小10GiB,/var分区增加10GiB ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# df -h | grep sd /dev/sda2 40G 5.3G 33G 14% / /dev/sda3 9.9G 2.6G 6.8G 28% /var /dev/sda1 1008M 199M 758M 21% /boot /dev/sda6 405G 338G 47G 88% /home ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 复制一份自定义grub菜单文件用做gparted live启动菜单 cd /etc/grub.d/ cp -av 41_custom 50_gpartedlive ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# ll total 64 -rwxr-xr-x 1 root root 7704 Jun 29 2012 00_header -rwxr-xr-x 1 root root 10447 Jun 29 2012 10_linux -rwxr-xr-x 1 root root 10049 Jun 29 2012 20_linux_xen -rwxr-xr-x 1 root root 899 Jun 29 2012 20_memtest86+ -rwxr-xr-x 1 root root 9343 Jun 29 2012 30_os-prober -rwxr-xr-x 1 root root 214 Jun 29 2012 40_custom -rwxr-xr-x 1 root root 216 Jun 29 2012 41_custom -rwxr-xr-x 1 root root 566 Mar 3 17:59 50_gpartedlive -rw-r--r-- 1 root root 483 Jun 29 2012 README ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 编辑gparted live启动菜单文件 ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# vim 50_gpartedlive ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# cat 50_gpartedlive #!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. # echo "Adding GParted Live 0.14.1-6 (03-Mar-2013)" >&2 menuentry "GParted Live 0.14.1-6 (03-Mar-2013)" { set root='hd0,msdos1' linux /gpartedlive/live/vmlinuz boot=live config union=aufs noswap noprompt vga=788 ip=frommedia live-media-path=/gpartedlive/live bootfrom=/dev/sda1 toram=filesystem.squashfs initrd /gpartedlive/live/initrd.img } ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 备份现有grub.cfg cp /boot/grub/grub.cfg /boot/grub/grub.cfg_03mar2013 重新生成grub.cfg ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# grub-mkconfig -o /boot/grub/grub.cfg Generating grub.cfg ... Found linux image: /boot/vmlinuz-linux Found initrd image: /boot/initramfs-linux.img done ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 检查新的grub.cfg ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# tail -n 15 /boot/grub/grub.cfg source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ### ### BEGIN /etc/grub.d/50_gpartedlive ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. # echo "Adding GParted Live 0.14.1-6 (03-Mar-2013)" >&2 menuentry "GParted Live 0.14.1-6 (03-Mar-2013)" { set root='hd0,msdos1' linux /gpartedlive/live/vmlinuz boot=live config union=aufs noswap noprompt vga=788 ip=frommedia live-media-path=/gpartedlive/live bootfrom=/dev/sda1 toram=filesystem.squashfs initrd /gpartedlive/live/initrd.img } ### END /etc/grub.d/50_gpartedlive ### ┌─[root@tp]─[/etc/grub.d]─[9+0]─[99%=] └─# 重启并选择新增的菜单"GParted Live 0.14.1-6 (03-Mar-2013)"进入gparted live系统,进行具体的分区大小调整,全是类似PQ Magic的图形化操作,这里不再详述。 调整完后,重启,检查结果 ┌─[root@tp]─[~]─[0+1]─[99%=] └─# df -h | grep sd /dev/sda2 30G 5.1G 23G 19% / /dev/sda6 405G 338G 47G 88% /home /dev/sda1 1008M 199M 758M 21% /boot /dev/sda3 20G 2.6G 17G 14% /var ┌─[root@tp]─[~]─[0+1]─[99%=] └─# REF: 1. Gparted-Live https://wiki.archlinux.org/index.php/Gparted-Live 2. Manually adding/removing entries to Grub 2 Menu http://ubuntuguide.net/manually-addingremoving-entries-to-grub-2-menu 3. GRUB2 (简体中文) https://wiki.archlinux.org/index.php/GRUB2_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29转载地址:http://yitai.baihongyu.com/