底部更新
我的 Ubuntu 分区的可用空间不足,因此我决定将 Windows 分区从大约 400GiB 缩小到 190GiB。缩小后仍有大约一半未使用。
使用 Gparted 缩小 Windows 10 分区(位于 /dev/sda4 上)后,Windows 启动管理器(位于 /dev/sda2 上)无法工作。我还添加了“启动”标志。
我不知道哪里出了问题。如果需要任何信息,请回答如何获取该信息。
我认为 Windows 分区在缩小之前是 efi,但我不确定。
boot-repair
带有推荐选项的 BootInfo 文件:
文件gparted_details
:
GParted 0.25.0 --enable-libparted-dmraid --enable-online-resize
Libparted 3.2
Shrink /dev/sda4 from 393.45 GiB to 190.43 GiB 00:05:05 ( SUCCESS )
calibrate /dev/sda4 00:00:03 ( SUCCESS )
path: /dev/sda4 (partition)
start: 1900544
end: 827034367
size: 825133824 (393.45 GiB)
check file system on /dev/sda4 for errors and (if possible) fix them 00:00:33 ( SUCCESS )
ntfsresize -i -f -v /dev/sda4 00:00:33 ( SUCCESS )
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda4
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 422468514304 bytes (422469 MB)
Current device size: 422468517888 bytes (422469 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 100204 MB (23,7%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
Multi-Record : 247041 MB 560736
$MFTMirr : 1 MB 1
Compressed : 251592 MB 526808
Sparse : 137684 MB 35
Ordinary : 251593 MB 25298
You might resize at 100203016192 bytes or 100204 MB (freeing 322265 MB).
Please make a test run using both the -n and -s options before real resizing!
shrink file system 00:04:18 ( SUCCESS )
run simulation 00:00:35 ( SUCCESS )
ntfsresize --force --force -s 204474417152 --no-action /dev/sda4 00:00:35 ( SUCCESS )
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda4
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 422468514304 bytes (422469 MB)
Current device size: 422468517888 bytes (422469 MB)
New volume size : 204474413568 bytes (204475 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 100204 MB (23,7%)
Collecting resizing constraints ...
Needed relocations : 1918076 (7857 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.
real resize 00:03:43 ( SUCCESS )
ntfsresize --force --force -s 204474417152 /dev/sda4 00:03:43 ( SUCCESS )
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda4
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 422468514304 bytes (422469 MB)
Current device size: 422468517888 bytes (422469 MB)
New volume size : 204474413568 bytes (204475 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 100204 MB (23,7%)
Collecting resizing constraints ...
Needed relocations : 1918076 (7857 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda4'.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
1) create it at the same disk sector (use sector as the unit!)
2) create it with the same partition type (usually 7, HPFS/NTFS)
3) do not make it smaller than the new NTFS filesystem size
4) set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.
shrink partition from 393.45 GiB to 190.43 GiB 00:00:11 ( SUCCESS )
old start: 1900544
old end: 827034367
old size: 825133824 (393.45 GiB)
new start: 1900544
new end: 401264639
new size: 399364096 (190.43 GiB)
========================================
输出sudo mount /dev/sda2
:
mount: /dev/sda2 is already mounted or /boot/efi busy
/dev/sda2 is already mounted on /boot/efi
`sudo mount /dev/sda4 的输出
mount: can't find /dev/sda4 in /etc/fstab
输出sudo parted -l
:
Model: ATA HGST HTS545050A7 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 524MB 523MB ntfs Basic data partition hidden, diag
2 524MB 839MB 315MB fat32 EFI system partition boot, esp
3 839MB 973MB 134MB Microsoft reserved partition msftres
4 973MB 205GB 204GB ntfs Basic data partition boot, esp
8 423GB 472GB 48,6GB ext4
9 472GB 476GB 3847MB linux-swap(v1)
5 476GB 476GB 489MB ntfs hidden, diag
6 476GB 499GB 22,7GB ntfs Basic data partition hidden, diag
7 499GB 500GB 1074MB fat32 Basic data partition hidden, diag
更新:
我已经使用过boot-repair
(s1ns3nt 的评论),Windows 启动管理器现在可以正常工作,但尝试启动 Windows 10(从 Windows 启动管理器)时,我又回到了 grub!我的启动顺序是:
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0000,0002
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0002* ubuntu
我不确定Boot0002* ubuntu
是什么。我也不确定星号 (*) 是什么意思。
答案1
安装并运行boot-repair
,并确保没有“启动”标志(在 gparted 中)即可解决问题。一切都正常启动。