• How to shrink a partition and add space to Windows

    From bilsch01@usenet@writer.com to comp.sys.ibm.pc.hardware.storage on Sun Oct 8 22:30:26 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    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
    /dev/nvme0n1p2 534528 567295 32768 16M MSoft reserved /dev/nvme0n1p3 567296 201311502 200744207 95.7G MSoft basic data /dev/nvme0n1p4 496840704 500117503 3276800 1.6G Win recovery env /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.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Marco Moock@mm+usenet-es@dorfdsl.de to comp.sys.ibm.pc.hardware.storage on Mon Oct 9 09:10:53 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    Am 08.10.2023 um 22:30:26 Uhr schrieb bilsch01:

    QUESTION #1 is SWAP the ext4 part. shown above with mount point = /
    or is it the other ext4 partition?

    Check /etc/fstab to find the partition that is used as swap.
    Current version can also use a swap file, so no separate partition is
    needed.

    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?

    Boot a live system and use gparted to shrink the Ubuntu partitions.
    To make changes to the windows partition, windows must be shut down
    properly, so disable Fastboot.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From bilsch01@usenet@writer.com to comp.sys.ibm.pc.hardware.storage on Mon Oct 9 12:00:34 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    On 10/9/2023 12:10 AM, Marco Moock wrote:
    Am 08.10.2023 um 22:30:26 Uhr schrieb bilsch01:

    QUESTION #1 is SWAP the ext4 part. shown above with mount point = /
    or is it the other ext4 partition?

    Check /etc/fstab to find the partition that is used as swap.
    Current version can also use a swap file, so no separate partition is
    needed.


    my etc/fstab ends with mention of 'swap' as shown below, however I don't
    know how to interpret it.
    Does it say that character '/' represents the swap partition?

    # /boot/efi was on /dev/nvme0n1p1 during installation
    UUID=CEF6-AB66 /boot/efi vfat umask=0077 0 1
    /swapfile none swap sw
    0 0
    bill:~$

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From bilsch01@usenet@writer.com to comp.sys.ibm.pc.hardware.storage on Mon Oct 9 12:08:24 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    On 10/9/2023 12:10 AM, Marco Moock wrote:
    Am 08.10.2023 um 22:30:26 Uhr schrieb bilsch01:

    QUESTION #1 is SWAP the ext4 part. shown above with mount point = /
    or is it the other ext4 partition?

    Check /etc/fstab to find the partition that is used as swap.
    Current version can also use a swap file, so no separate partition is
    needed.

    I should have said: when GPARTED shows mount point as '/' does that mean
    that partition is the swap?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Marco Moock@mm+usenet-es@dorfdsl.de to comp.sys.ibm.pc.hardware.storage on Wed Oct 11 20:41:23 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    Am 09.10.2023 um 12:00:34 Uhr schrieb bilsch01:

    /swapfile none swap sw

    Then you use a swap file and not a swap partition.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Marco Moock@mm+usenet-es@dorfdsl.de to comp.sys.ibm.pc.hardware.storage on Wed Oct 11 20:41:54 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    Am 09.10.2023 um 12:08:24 Uhr schrieb bilsch01:

    On 10/9/2023 12:10 AM, Marco Moock wrote:
    Am 08.10.2023 um 22:30:26 Uhr schrieb bilsch01:

    QUESTION #1 is SWAP the ext4 part. shown above with mount point = /
    or is it the other ext4 partition?

    Check /etc/fstab to find the partition that is used as swap.
    Current version can also use a swap file, so no separate partition
    is needed.

    I should have said: when GPARTED shows mount point as '/' does that
    mean that partition is the swap?

    No / is never the swap partition.
    You fstab shows it and it is a swapfile directly on the root partition
    (/).

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Paul@nospam@needed.invalid to comp.sys.ibm.pc.hardware.storage on Thu Oct 12 02:32:03 2023
    From Newsgroup: comp.sys.ibm.pc.hardware.storage

    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


    --- Synchronet 3.20a-Linux NewsLink 1.114