1

i dual boot with ubuntu and windows. I have a separate /home partition for ubuntu, which i want to delete and create a new partition out of it, which i will share between ubuntu and windows.

The reason i am doing this is because i will keep my project files in that partition which can be accessed by both windows and ubuntu.

can i just delete the partition from easeus partition master in windows and then go to ubuntu and delete the entry in /mnt/root/etc/fstab ? Edit: don't do it.

vikrant
  • 807
  • You will lose all you configurations & data. You should be backing that up. Better to use gparted for Linux and only use Windows tools for Windows. You can copy /home partition into /home folder and remove fstab entry. If you remove entry first, it will create a new default /home on reboot, then copy data, then delete partition using live installer. Post these: sudo parted -l and df -h – oldfred May 11 '20 at 12:55
  • @vikrant you may want to move all the contents (except lost+found so some newly created subfolder of /. Once done, you unmount /home and adjust fstab to no longer reference the partition and then you rename the aforementioned subfolder to /home. Only caveat, you'll likely have to do this as root, because otherwise /home will be in use (and refuse being unmounted and such). – 0xC0000022L May 11 '20 at 12:59
  • I agree with the above two. 1. Make sure you have enough room in root for all your files. Move all files to a temporary locaion on root. Make an extra backup to a USB drive. 2. Then modify fstab by commenting out the old home. On reboot a new home will be made. Copy files back in. – walttheboss May 11 '20 at 13:02
  • I deleted the home partition with easeus and it completely messed up the other Linux partitions and even the recovery partition of windows. I knew I was taking a risk but it didn't hurt me as both ubuntu and windows were fresh installs. Now I am doing it all over again. – vikrant May 11 '20 at 13:14

3 Answers3

2

I have a separate /home partition for ubuntu, which i want to delete and create a new partition out of it, which i will share between ubuntu and windows.

Not possible. /home MUST be posix compliant: so it needs to be ext2, 3 or 4. Windows is not posix compliant. You can only set permissions when mounting NTFS and everything then is set to that user and group. /home/ has more than 1 owner for files so that makes NTFS unusable. Linux will refuse to work with a /home that is NTFS.

Also: Never delete /home/: you create a point of no return and you should always avoid those. A /home/ is best placed on the SAME DISK as /. Otherwise it might end up NOT mounting during boot and you'll have more problems than needed

Please create a new mount point (and that new mount point can be NTFS so you can share it with Windows) and then edit ~./config/users-dirs.dirs to use that mount point; the list of directories can be on any if the mayor filesystems. All of this can be created before copying (not moving) files from /home/ to the new mount point and all you need to move are the normal directories; not the hidden files in /home/.

After you are confident this went well you can remove the directories in /home/.

Rinzwind
  • 299,756
  • By sharing I meant just mounting that partition as any other NTFS partition and using it in ubuntu, instead of a dedicated home partition – vikrant May 11 '20 at 14:05
  • As long as that partition is not used as a /home/; that must be ext. – Rinzwind May 11 '20 at 14:17
0

Yes, it is possible. Following steps will remove your /home partition and append it to / partition.

  1. Backup your /home to /home.tar!

    Go to / directory and creating a tar file from /home with following command:

    # tar cfv home.tar /home/
    
  2. Go to /etc/fstab and comment or remove the /home mount point. For example:

    # /home was on /dev/nvme0n1p6 during installation
    #UUID=413492da-e763-4525-a7fa-07de326b013d /home           ext4    defaults        0       2
    

    Note you can't login on your system! You should go to recovery mode and get shell access.

  3. Set init=/bin/sh during boot process:

    1. Reboot your system.

    2. Press the E key on one of your GRUB menu entries and go to the following line:

      linux   /vmlinuz-5.4.0-131-generic root=UUID=b2fabf20-8454-477d-9114-e22829b213e6 ro
      
    3. Edit this line similar to following line:

      linux   /vmlinuz-5.4.0-131-generic rw init=/bin/sh
      
    4. Then press Ctrl+X to boot the system and get shell access.

  4. Unpack your home.tar to empty the /home directory.

    cd / 
    tar xfv /home.tar
    
  5. Check your home directory and users. You can check your directory by loging into some users using su command and making sure you are right.

  6. Reboot and enjoy your life :)

My system specifications:

OS: Ubuntu 20.04.4 LTS x86_64 
Kernel: 5.4.0-131-generic 
Shell: bash 5.0.17 
Resolution: 1920x1080 
CPU: Intel i3-9100F (4) @ 4.200GHz 
GPU: NVIDIA GeForce GT 1030 
Memory: 2380MiB / 15948MiB 
0
  1. Open Ubuntu partition, right click and open as administrator. if you dont find open as administrator in the menu, you can install it by:
    sudo apt install nautilus-admin

    sudo nautilus -q

  2. Open /etc/fstab, delete this line:

    # /home was on /dev/sdax during installation UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home ext4 defaults 0 2
    you will see numbers or letters instead of x. save the fstab file.

  3. Restart, after log on be patient to be able to open settings, make new user account and restart.

  4. log on by new user account, copy your old username folder from home partition to home folder in ubuntu parition and log out.

  5. log on by old user name, open home folder in ubuntu partition, right click open as administrator, open in terminal and write this command:
    sudo chown -R username ./username

    replace username by your old user name

  6. Restart, log on to your old user account, all your home files and settinges here, from now you can delete the new user account and format the old home paartiton.
    I tested this way by myself on ubuntu 22.04