博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ArchLinux下通过Grub2引导进入GPartedLive动态调整分区大小
阅读量:4176 次
发布时间:2019-05-26

本文共 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/

你可能感兴趣的文章
openocd zylin
查看>>
进程创建时文件系统处理
查看>>
内核线程创建
查看>>
linux中cat命令使用详解
查看>>
java中的异常机制
查看>>
商务智能-基本方法-数据钻取
查看>>
C++程序员技术需求规划(发展方向)
查看>>
LSTM
查看>>
K-means中K值的选取
查看>>
kmeans优化算法
查看>>
牛客网 构造队列
查看>>
牛客网 跳石板
查看>>
牛客网 最大的奇约数
查看>>
python大坑:AttributeError: 'module' object has no attribute 'Workbook'
查看>>
python 协程
查看>>
在写计算器时学到的
查看>>
小Q的歌单
查看>>
牛客网 计算机网络 选择题及知识点 (1)
查看>>
0-1背包问题
查看>>
TCP-IP详解卷1:协议 学习笔记(5) RARP ICMP
查看>>