1

My PC dual boots Ubuntu and Windows 7. Ubuntu was installed into a small partition of only 88 GB and i want at least 500 GB for Ubuntu. The boot drive has a

Windows partition of 200 GB
a program partition of 630 GB
and an Ubuntu partition of 88 GB.

Can I reinstall Ubuntu and resize it?

If not, can I install Ubuntu on my other 2 TB drive and still dual boot easily? Is it just to partition to not let Ubuntu to take up all the space on the 2 TB drive on installation? If so, how?

Disk /dev/sda: 1,8 TiB, 2000398934016 byte, 3907029168 sektorer
Disketikettstyp: dos
Diskidentifierare: 0x7893b811

Enhet      Start     Början     Slutet   Sektorer Storlek Id Typ
/dev/sda1              2048 2708940799 2708938752    1,3T  7 HPFS/NTFS/exFAT
/dev/sda2        2708940800 3907028991 1198088192  571,3G 83 Linux


Disk /dev/sdb: 931,5 GiB, 1000204886016 byte, 1953525168 sektorer
Disketikettstyp: dos
Diskidentifierare: 0x96aeb6b8

Enhet      Start     Början     Slutet   Sektorer Storlek Id Typ   
/dev/sdb1  *           2048     206847     204800    100M  7 HPFS/NTFS/exFAT   
/dev/sdb2            206848  409602047  409395200  195,2G  7 HPFS/NTFS/exFAT   
/dev/sdb3         409602048 1743804415 1334202368  636,2G  7 HPFS/NTFS/exFAT    
/dev/sdb4        1743806462 1953523711  209717250    100G  5 Utökad    
/dev/sdb5        1743806464 1928364031  184557568     88G 83 Linux   
/dev/sdb6        1928366080 1953523711   25157632     12G 82 Linux växling / Solaris   


Disk /dev/sdc: 57,7 GiB, 61907927040 byte, 120913920 sektorer
Disketikettstyp: dos
Diskidentifierare: 0x5a2b4c5e

Disk /dev/mapper/cryptswap1: 1,8 GiB, 1872232448 byte, 3656704 sektorer

Disk /dev/mapper/cryptswap2: 12 GiB, 12880183296 byte, 25156608 sektorer

I have already made a new ext4 partition, mounted it in /mnt, and started copying the /home directory with sudo rsync -avx /home/ /mnt (didn't think you were going to help me this much) but the drive doesn't show up?

output of lsblk  (loop and ROM devices removed)

NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0   1,8T  0 disk  
├─sda1           8:1    0   1,3T  0 part  
├─sda2           8:2    0 569,6G  0 part  /mnt
└─sda3           8:3    0   1,8G  0 part  
  └─cryptswap1 253:0    0   1,8G  0 crypt [SWAP]
sdb              8:16   0 931,5G  0 disk  
├─sdb1           8:17   0   100M  0 part  
├─sdb2           8:18   0 195,2G  0 part  
├─sdb3           8:19   0 636,2G  0 part  
├─sdb5           8:21   0    88G  0 part  /
└─sdb6           8:22   0    12G  0 part  
  └─cryptswap2 253:1    0    12G  0 crypt [SWAP]
sdc              8:32   1  57,7G  0 disk  
K7AAY
  • 17,202
sluxx
  • 13
  • 6
    See the solutions here: Possible duplicate of How do I install Ubuntu alongside a pre-installed Windows with UEFI?. If either of the operating systems are unbootable and corrupted, it may be a better path to wipe your hard drive and start over installing Windows first, then Ubuntu. FYI Windows 7 reaches end of life in January at which point it will become unsafe to use online so this would be a good opportunity to replace it. – Nmath Nov 08 '19 at 17:37
  • @sluxx Aha! You boot from /dev/sdb not /dev/sda ! I removed the loop devices because they don't help us understand what's going on, and put a triple backtick above and below the partition data so it appears in a monospaced font for clarity. – K7AAY Nov 08 '19 at 19:26
  • yes i know but i dont know why? as i said erlier it was a long time ago since i made this dual boot and i didnt really know what i was doing... – sluxx Nov 08 '19 at 19:29
  • i use 18.04 i upgrade from 16.04 yesterday. and no i dont use hibernation. so yes if you can guide me :) – sluxx Nov 08 '19 at 19:39
  • should i remove the encryption first and then resume with the migration? – sluxx Nov 08 '19 at 20:56
  • Yes. Delete the swaps. Create new swap file following https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/ by these commands sudo swapon --show && sudo swapoff -a && sudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152 && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && sudo nano /etc/fstab and in nano editor add this line /swapfile swap swap defaults 0 0 then save and exit. Confirm swap function with sudo swapon --show && sudo free -h . – K7AAY Nov 08 '19 at 21:27
  • okey i do that after i have moved the /home. how should i proceed to move it? – sluxx Nov 08 '19 at 21:32

1 Answers1

1

Can I reinstall Ubuntu and resize it? Yes, you can.

HOWEVER, there's a simpler and safer solution. You can move just part of your Ubuntu filesystem to the 2 TB drive, without reinstalling either Ubuntu or Windows. This eliminates the chance of making a mistake in the process.

There's an ideal standard for Linux directories, the Filesystem Hierarchy Standard (more). You can see that if you go to the root directory of your Ubuntu drive with the Files app.

/ (AKA root)
/bin
/boot
/dev
/etc
/home
/lib, /lib64, /lib32
/media
/mnt
/opt
/sbin
/srv
/tmp
/usr
/var

Unlike Windows which likes to put everything on C:, Linux makes it easy to put those different parts of the filesystem on different partitions, even different drives.

The simplest (and default) Linux installation is to put everything under / (the 'root', the top level directory). That's what you normally get when you install.

Now, you can easily copy everything from /home to a new Linux (ext4) partition you make on your 2TB drive, which you can size as you wish with gparted, and resize later if you need to.

Why /home? It's the directory which is most likely to grow.

After copying /home from the smaller drive to the 2 TB drive, you verify everything arrived OK, then tell Ubuntu to look for /home on the 2TB drive now, then erase the old home files on the smaller drive.

Voila! You've now expanded Ubuntu's drive space without a reinstall! Once you move /home off your boot drive, you will have a lot of room for expansion of the other bits of Ubuntu, but if you need to move more directories off the smaller drive, that's also easy to do.

STEP BY STEP

0) Make a list of your drives and their partitions the way they are now from a Ubuntu Terminal window with sudo fdisk -l. Then, click on the edit link under your original question, and paste the results you copy from that terminal into your original question, so we can double check what's going on.

1) With the gparted program which comes with Ubuntu, choose the 2 TB drive (maybe it's /dev/sdb? Sometimes it's different; make sure you've got the right drive!).

The block in the orange box shows which drive you're looking at; the blue tab button shows you all available drives and lets you change the drive. When you start gparted, it will start with your system drive, probably /dev/sda, so you will need to change drives.

gparted screen

2) Resize the partition(s) on the 2TB drive and make a new ext4 type partition for Ubuntu's home. How big? Well, how big is your /home right now? In step 0 above, we found out, or you can open the Files app which comes with Ubuntu. Multiply that size by five or ten.

It's important to make one change at a time with gparted. You have to make room for your new ext4 partition for your new /home, before you can create it. Choose where you will put it, shrink the partition which is there now, then click on the check mark at upper center (in the purple circle in the picture) to actually go ahead and make the change.

Once you have made space, then you can create the new ext4 partition for your new /home; right-click on unassigned space, and create a new partition with type Primary, name /home, filesystem ext4, label /home, and click on the checkmark.

3) When through repartitioning, close gparted and get back to a Terminal, to run sudo lsblk which will show us more info we will need soon. Again, click on the edit link under your original question, and paste the results you copy from that terminal into your original question, so we can double check what's going on.

SPEED BUMP

We stop here before outlining the next steps ( copying everything from your original /home to the 2 TB drive, checking to make sure it's AOK, then making that your new /home, and deleting the old files in the old /home) because a review of your drives and partitions is a VERY good idea before moving on!

K7AAY
  • 17,202
  • thank you for the replay! but how du i move the home to the other drive? and is the 88gb enough if i just move the /home? – sluxx Nov 08 '19 at 18:29
  • thanks again really, but i just rememver that my home is encrypted is this going to be a problem? it dont need to be encrypted really. – sluxx Nov 08 '19 at 19:09
  • @sluxx If you don't want the new /home to be encrypted, no problem, simplifies things. You will copy files from it after signing into Ubuntu, which unlocks the encryption, so no problem there, either. Check back after you've done steps 0-3 and I'll confirm everything's ready to proceed. Since I've linked to instructions, anyone can help you, in case I get subpoenaed by the Congress or abducted by a flying saucer. – K7AAY Nov 08 '19 at 19:12
  • it looked like it copeid everything but encrypted, but nothin is in the username folder? – sluxx Nov 08 '19 at 19:21
  • @sluxx Please find the files which were copied to the destination and make sure they match the source. An easy way to do that is to tar the files at the source and the destination tar -czvf name-of-archive.tar.gz /path/to/directory-or-file then compare the two tar files with vimdiff <(xxd -c1 -p FILE1) <(xxd -c1 -p FILE2) – K7AAY Nov 08 '19 at 21:35
  • okey but it was only the .private and .ecryptfs that was copied is it something to do with the encryption? – sluxx Nov 08 '19 at 21:51
  • i used this command sudo rsync -avx /home/ /mnt – sluxx Nov 08 '19 at 22:01
  • Not an encryption user, sorry. – K7AAY Nov 08 '19 at 22:43
  • i think i have solved it and is now checking for difference. i saw somthine about a binary file and the rest just file or catalog not found, but what i have been reading it is supposed to so? – sluxx Nov 08 '19 at 22:57
  • tar http://manpages.ubuntu.com/manpages/bionic/man1/tar.1.html makes a binary file, in this case a compressed archive of all the files specified. If you tar the source files and tar the destination files, and the tar file sizes match, the destination matches the source (and, OBTW, you now have a backup of everything which was in your old /home... wasn't that easy?) – K7AAY Nov 08 '19 at 23:00
  • okey i understand, thanks for all the help really! and sorry for maybe be a bit slow. do you whant to tell me what next step is? – sluxx Nov 08 '19 at 23:08
  • All spelled out at https://help.ubuntu.com/community/Partitioning/Home/Moving – K7AAY Nov 08 '19 at 23:19