确保您已对重要的 Ubuntu 文件进行良好的备份,因为此过程可能会损坏或丢失数据。

确保您已对重要的 Ubuntu 文件进行良好的备份,因为此过程可能会损坏或丢失数据。

我是 Ubuntu 新手。最近我重新安装了 Ubuntu,发现原来的 Ubuntu 系统是这样的

Filesystem      Size  Used Avail Use% Mounted on  
/dev/nvme0n1p8   69G  4.6G   61G   7% /media/david/ec0fd309...  

我当前的系统是

/dev/nvme0n1p5   15G  8.8G  5.4G  62% /    

由于有 Windows 系统,/media/david/Windows 所以我想知道是否有办法将旧系统合并到新系统中。

的结果sudo fdisk -l

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    534527    532480   260M EFI System
/dev/nvme0n1p2    534528    567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296 288354303 287787008 137.2G Microsoft basic data
/dev/nvme0n1p4 498069504 500117503   2048000  1000M Windows recovery environment
/dev/nvme0n1p5 288354304 320354303  32000000  15.3G Linux filesystem
/dev/nvme0n1p6 320354304 352354303  32000000  15.3G Linux swap
/dev/nvme0n1p7 352354304 352854015    499712   244M Linux filesystem
/dev/nvme0n1p8 352854016 498069503 145215488  69.3G Linux filesystem 

我认为我需要将存储空间合并/dev/nvmen1p8/dev/nvmen1p5

我搜索了一下,找到了一些与 GParted 相关的解决方案,但是我使用默认设置重新安装 Ubuntu,所以我想也许有一种方便的方法。
以下是有关所有文件系统的信息。

Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           775M  9.6M  766M   2% /run
/dev/nvme0n1p5   15G  9.1G  5.1G  65% /
tmpfs           3.8G  132M  3.7G   4% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/nvme0n1p1  256M   34M  223M  14% /boot/efi
tmpfs           775M   56K  775M   1% /run/user/1000
/dev/nvme0n1p8   69G  4.6G   61G   7% /media/david/ec0fd309...
/dev/nvme0n1p3  138G   33G  105G  24% /media/david/Windows

GParted 屏幕截图

的结果sudo mkdir /mntp7 && sudo mount /dev/nvme0n1p7 /mntp7 && ls -l /mntp7

➜  / sudo mkdir /mntp7
[sudo] password for david: 
➜  / ls
bin  boot  cdrom  dev  etc  home  initrd.img  initrd.img.old  lib      lib64  lost+found  media  mnt  mntp7  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
➜  / sudo mount /dev/nvme0n1p7 /mntp7
➜  / ls -l /mntp7
total 161417
-rw-r--r-- 1 root root  1246246 Apr  20 20:02 abi-4.4.0-75-generic
-rw-r--r-- 1 root root  1407843 Feb   5 19:32 abi-4.8.0-36-generic
-rw-r--r-- 1 root root  1408671 Apr  20 21:07 abi-4.8.0-49-generic
-rw-r--r-- 1 root root   190214 Apr  20 20:02 config-4.4.0-75-generic
-rw-r--r-- 1 root root   199575 Feb   5 19:32 config-4.8.0-36-generic
-rw-r--r-- 1 root root   199588 Apr  20 21:07 config-4.8.0-49-generic
drwxrwxr-x 2 root root     1024 Apr  25 19:26 efi
drwxr-xr-x 5 root root     1024 Apr  26 19:00 grub
-rw-r--r-- 1 root root 37695951 Apr  26 19:00 initrd.img-4.4.0-75-generic
-rw-r--r-- 1 root root 41298900 Apr  25 19:36 initrd.img-4.8.0-36-generic
-rw-r--r-- 1 root root 40063966 Apr  26 15:33 initrd.img-4.8.0-49-generic
drwx------ 2 root root    12288 Apr  25 19:26 lost+found
-rw-r--r-- 1 root root   182704 Jan  28  2016 memtest86+.bin
-rw-r--r-- 1 root root   184380 Jan  28  2016 memtest86+.elf
-rw-r--r-- 1 root root   184840 Jan  28  2016 memtest86+_multiboot.bin
-rw------- 1 root root  3883390 Apr  20 20:02 System.map-4.4.0-75-generic
-rw------- 1 root root  4060748 Feb   5 19:32 System.map-4.8.0-36-generic
-rw------- 1 root root  4066773 Apr  20 21:07 System.map-4.8.0-49-generic
-rw------- 1 root root  7081872 Apr  20 20:02 vmlinuz-4.4.0-75-generic
-rw-r--r-- 1 root root  7297312 Apr  25 19:27 vmlinuz-4.8.0-36-generic
-rw------- 1 root root  7305856 Apr  20 21:07 vmlinuz-4.8.0-49-generic
-rw------- 1 root root  7307768 Apr  25 19:36 vmlinuz-4.8.0-49-generic.efi.signed

这样做的结果vi /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=720839ca-117c-4103-91a8-c21f3b39cf7c /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=908D-193B  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/nvme0n1p6 during installation
UUID=468d2512-9472-4d90-af6c-f38d5614be13 none            swap    sw              0       0

的结果sudo mkdir /mntp1 && sudo mount /dev/nvme0n1p1 /mntp1 && ls -l

➜  ~ sudo mkdir /mntp1 && sudo mount /dev/nvme0n1p1 /mntp1 && ls -l /mntp1
ls: cannot open directory '/mntp1': Permission denied
➜  ~ cd /
➜  / sudo su
root@david:/# cd mntp1
root@david:/mntp1# ls -l
total 8
drwx------ 2 root root 4096 Mar  29 02:52 BOOT
drwx------ 5 root root 4096 Apr  25 19:36 EFI
root@david:/mntp1# cd BOOT
root@david:/mntp1/BOOT# ls -l
total 3096
-rwx------ 1 root root 3170304 June  16  2016 BOOT.SDI
root@david:/mntp1/EFI# ls -l
total 12
drwx------ 2 root root 4096 Mar  29 02:52 Boot
drwx------ 4 root root 4096 Mar  29 02:52 Microsoft
drwx------ 3 root root 4096 Apr  27 18:45 ubuntu

调整后的 GParted 截图

答案1

我在等待 p1 和 /etc/fstab 的信息时做了以下场景。
在我们确定已涵盖所有内容之前,请不要采取这些行动。

更新#1:

确保您已对重要的 Ubuntu 文件进行良好的备份,因为此过程可能会损坏或丢失数据。

请记住以下几点:

  • 始终以在任何已挂载的交换分区上发出 来启动整个过程,并以在同一个交换分区上swapoff发出 来结束整个过程swapon

  • A移动通过将鼠标指针指向分区的中心,然后使用手形光标向左/向右拖动来完成

  • A调整大小通过使用方向箭头光标将分区的左侧/右侧向左/向右拖动来完成

  • 如果任何分区无法移动/调整大小图形上,你可能必须手动输入所需的具体数字数据(除非我指示你这样做,否则不要这样做)

  • 你开始任何移动/调整大小右键单击主窗口下部的分区,从弹出菜单中选择所需操作,然后在新移动/调整大小窗户


Proposed actions per partition:
NB. Make sure there are no links in your p5 partition to p7/p8 directory or files.
If so, these must be removed.

1 /dev/nvme0n1p5
  to be expanded to larger size
2 /dev/nvme0n1p6
  Current Linux swap. Move partition to end of disk.
3 /dev/nvme0n1p7
  p7 holds grub/efi files. Move partition to right of disk.
4 /dev/nvme0n1p8
  old Ubuntu, will be deleted, space re-used.

Boot from the Ubuntu Live USB/CD and select Try Ubuntu.
Start gparted.

Right-click p8; select 'Delete'; click the green Apply sign; Apply; Close.
More unallocated space and in the graphic bar.

Right-click p7; select Resize/Move.
In the Resize/Move window click the middle of the slider; drag it to the right.
Click Resize/Move; Apply sign; Close.

Right-click p6 Linux-swap; select 'Swapoff'.
Right-click p6 Linux-swap; select Resize/Move.
In the Resize/Move window click the middle of the slider; drag it to the right.
Click Resize/Move; Apply sign; Close.
Right-click p6 Linux-swap; select 'Swapon`

Right-click p5; select Resize/Move.
In the Resize/Move window click the right arrow of the slider and enlarge to the full.
Click Resize/Move; Apply sign; Close.

Close gparted.

更新 #2:

要正确准备 Windows 与 Ubuntu 的双启动配置,请执行以下操作。

在 Windows 中

  • 启动进入 Windows
  • 打开电源控制面板
  • 选择change what the power buttons do
  • 选择change options that are unavailable
  • 取消选中fast startup
  • 关闭电源控制面板
  • 打开管理命令提示符窗口
  • 类型powercfg /h off
  • 类型chkdsk /f c:
  • 同意在下次重启时运行 chkdsk
  • 重新启动 Windows 以让 chkdsk 在驱动器 C 上运行:

相关内容