On 10/9/2023 1:30 AM, bilsch01 wrote:
> This PC came with Win10 on it and I added Ubuntu, including the
> so-called swap partition to be used w/Ubuntu. The disk is NVME type
> and uses modern GPT arrangement. I want to reduce the space used by
> the Ubuntu partition and swap partition and add to Windows.
>
> GPARTED shows the 3 big parts are physically sequential as follows:
> p3 96GB: ntfs, 58 used 38 unused, no mount point shown
> p6 43GB: ext4, 28 used 15 unused, mount point = /
> p5 98GB: ext4, 30 used 68 unused, no mount point shown
>
> FDISK -l output is as follows:
>
> Device Start End Sectors Size Type
> /dev/nvme0n1p1 2048 534527 532480 260M EFI System <=== FAT for EFI (boot, Ubuntu folder, Windows folder)
> /dev/nvme0n1p2 534528 567295 32768 16M MSoft reserved <=== NO FILESYSTEM IS PRESENT (sixteen megabytes)
> /dev/nvme0n1p3 567296 201311502 200744207 95.7G MSoft basic data <=== NTFS 0x07 Win10
> /dev/nvme0n1p4 496840704 500117503 3276800 1.6G Win recovery env <=== NTFS 0x27 Unmounted System Reserved MSoft ??? Size ?
> /dev/nvme0n1p5 292040704 496840703 204800000 97.7G Linux filesystem
> /dev/nvme0n1p6 201312256 292040703 90728448 43.3G Linux filesystem
>
> QUESTION #1 is SWAP the ext4 part. shown above with mount point = /
> or is it the other ext4 partition?
>
> QUESTION #2 is there a tool that comes with Windows or Ubuntu that
> can reduce size of Ubuntu and swap and add to Windows without
> removing and replacing Ubuntu and swap partitions?
>
> TIA. Bill S.
My favorite tool, for making a Windows-Disk-Management like display,
is gnome-disks. That's the graphical way.
[Picture[
https://i.postimg.cc/gc43dgn3/gnome-disks-aka-palimpset.gif
For a file system summary, you can...
sudo apt install disktype
sudo disktype /dev/sda
For disk resize/move, that would be sudo gparted /dev/sda
[Picture]
https://i.postimg.cc/GhxDzq14/sudo-gparted-for-resize-move.gif
On Windows, Paragon Partition Manager 14 Free, can do about as well
as GParted can do. This is the detail on my copy acquired years ago.
Name: pm14free_x64_eng.exe
Size: 53,091,632 bytes (50 MiB)
SHA256: 7F48097AC70AE6B27FCC5C40A10BBE7E42516DC7D73D0C48ABFFE1D50B2145CF
Potential source:
https://www.majorgeeks.com/files/details/paragon_partition_manager_express_free_edition.html
Windows itself, Disk Management can "shrink" or "extend" an NTFS partition,
but it cannot "move" the partition.
Disk Management, the NTFS Shrink is to 50% of original size (max shrink)
due to an inability to move some metadata located at 50% location.
With the right defragmenter, the metadata can be moved, and then
the Windows Shrink used again, but this is... silly, when Paragon
will do whatever you want, in one shot. Some Paragon operations
require a reboot, so the partition is offline.
Your Linux swap is likely set at 1.5x the system RAM. If you wanted
hibernation support, there could be some research to do. If
you don't need hibernation for Linux, you can drop the swap to
a token amount (1GB). In my first picture above, my swap is 1GB,
on a computer with 64GB of RAM. Modern computers generally have
enough RAM, that you don't really need a lot of swap. There are
still some super-cheap PCs for sale, and the manufacturers
have to work damn hard, to make small RAM for them. 8GB sticks
of RAM are readily available, as are 16GB sticks. You can also get
32GB sticks (DDR4 for example). Older computers, 2GB sticks were
more characteristic materials for them.
If you mess with swap, record the BLKID for later usage. Normally,
/etc/fstab also has "notes" about swap. After GParted is finished
messing with swap, you may need to correct the ID on the partition.
To modify swap, I would expect gparted would have to do a
"swapoff" so the swap can be modified. I don't know if I've ever
tried to shrink a swap, so good luck with that :-)
As for the "safety aspect" of gparted, it is pretty good for most
things. However, it absolutely destroyed an old mac disk setup.
The program said "yes, yes, I grok this". And when I asked it
to do a simple manipulation, the partition table was destroyed.
I looked at it with a hex editor, and I couldn't even see a
pattern to the damage :-/ Thus, as a user, use common sense with
that thing. Linux and Windows. No problem. Obscure disk type.
Take precautions. When the mac disk was destroyed, I had a backup.
Lucky, eh. I feel I was pretty lucky that day.
Paul