在 gparted 中:

在 gparted 中:

我最近在主笔记本电脑上安装了 Ubuntu 16.04 LTS。它已经预装了 Windows 10。起初我为 Ubuntu 安装分配了 70 GB 的内存。50 GB 分配给 /root,20 GB 分配给 /home 分区。我想知道如何增加分配给 Ubuntu 的磁盘空间。

sudo fdisk -l在终端中运行,以下是输出。

Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F2FDAD9A-3796-4517-929E-76BE3B882F60`

Device          Start        End   Sectors   Size Type
/dev/sda1        2048     923647    921600   450M Windows recovery environment
/dev/sda2      923648    1128447    204800   100M EFI System
/dev/sda3     1128448    1161215     32768    16M Microsoft reserved
/dev/sda4     1161216  512002047 510840832 243.6G Microsoft basic data
/dev/sda5   512002048  874942463 362940416 173.1G Microsoft basic data
/dev/sda6  1024002048 1536002047 512000000 244.1G Microsoft basic data
/dev/sda7  1536002048 1953523711 417521664 199.1G Microsoft basic data
/dev/sda8   874942464  984940543 109998080  52.5G Linux filesystem
/dev/sda9   984940544 1024002047  39061504  18.6G Linux filesystem

Partition table entries are not in disk order.

我附上了 Gparted 的屏幕截图。请帮我增加目录的磁盘root空间home

Gparted 屏幕截图

答案1

由于没有太多机会与 Shanu 讨论最终期望的目标配置,我将继续做出一些假设。

我们要做的是删除 sda6 并调整 sda9 的大小。我们将保留 sda7 作为 NTFS 分区,可用于在 Windows 和 Ubuntu 之间传输文件,或用作公共文件空间。我们还将添加交换分区。如果不能接受,就立即停止

在 gparted 中:

  • 启动至 Ubuntu Live DVD 或 USB
  • 右键单击分区 sda6 并选择删除
  • 右键单击分区 sda9 并选择调整大小
    • 在弹出的窗口中,在分区的图形表示中,将鼠标指针悬停在分区的右侧,它会变成一个箭头。将箭头拖到最右边,在 sda9 和 sda7 之间留下 16G 的未分配空间。单击“确定”。
  • 在 sda9 和 sda7 之间的空间中创建一个新分区。将其创建为交换文件系统。
  • 点击“应用”图标
  • 重启到 Ubuntu

在 Ubuntu 中:

如果您在 Ubuntu 中挂载了 sda6 和 sda7,并编辑了/etc/fstab,则需要编辑掉 sda6 的挂载。由于 sda6 不再存在,首次启动可能需要一段时间,因为它会查找 sda6 并超时。最坏的情况是 Ubuntu 可能根本无法启动,我们必须进入 root 权限才能编辑/etc/fstab如果需要的话,我会稍后添加该流程

terminal应用程序中:

  • 输入sudo blkid并记下唯一唯一标识符对于我们之前创建的交换分区
  • 类型gksudo gedit /etc/fstab
  • 编辑或注释掉 sda6 的挂载
  • 添加交换挂载,它看起来应该像这样:
    • UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b none swap sw 0 0
    • 改变唯一唯一标识符到前面提到的那个
  • 保存并退出 gedit
  • 键入swapon -a以启用交换
  • 输入swapon并观察第一行内存状态,第二行交换状态
  • 输入df -h并观察 /home 中的可用空间

在 Windows 中:

  • 打开电源控制面板
  • 点击change what the power buttons do
  • 点击change options that are unavailable
  • 取消选中fast start
  • 关闭电源控制面板
  • 打开管理命令提示符窗口
  • 类型powercfg /h off (关闭休眠模式)
  • 类型chkdsk /f c: (如果需要,将 c: 更改为正确的驱动器号)
  • 批准 chkdsk 在下次启动时运行
  • 重新启动 Windows

答案2

减少不需要的部分,增加需要的部分。比如说,缩小 sda4 或 sda5,然后扩大 sda8 和 sda9。

相关内容