merging partitions

aliyous

New Member
Joined
Feb 25, 2020
Messages
17
Reaction score
6
Credits
0
hello guys !

i've been using pop os for a week now and boy its just awesome ;)

before installing my new os i was win 10 user so i sliced 100 gig partition out of my only existing partition ( C ) via windows diskmanagement in case of anything going wrong so i dont lose all my data .
now that im sure everything works perfect i was wondering if its possible to format the ( C ) partition and merge it with the new one that boots my linux so my pc can use all space instead of the 100 gig i previously dedicated to it .
any help is appreciated as i'm extremely noob when it comes to linux :D
cheers
 


some people in slackware keep a section separate from root main install. That way when they do a system upgrade; stuff like libre office docs , photos etc in a separate section won't be affected.

Basically fpr partitions it would be some thin like

EFI (/dev/sda1) swap(/dev/sda2) OS root install ( /dev/sda3) assorted personal and junk (/dev/sda4)

what they do is designate /dev/sda4 as /home

instead of of merging , you could make spare section a primary partition and just mount it to drag and drop like onto a usb stick. You could run command each time ( a pain) or edit fstab and such like. See what others think ?
 
thanks for the reply captain
as i'm a big baboon while using linux could really use some more info about making this spare section or an app that could do that for me
thanks :)

edit : i used sudo sfdisk -l /dev /sda
and got this :
Code:
Device         Start        End   Sectors  Size Type
/dev/sda1       2048    1085439   1083392  529M Windows recovery environment
/dev/sda2    1085440    1290239    204800  100M EFI System
/dev/sda3    1290240    1323007     32768   16M Microsoft reserved
/dev/sda4    1323008  794009599 792686592  378G Microsoft basic data
/dev/sda5  794009600  997326847 203317248   97G Linux filesystem
/dev/sda6  997326848 1000214526   2887679  1.4G EFI System

after this i dont know how to do anything to sda4
 
Last edited:
Here is one solution, maybe not the easiest. I am a command line guy.

It looks like you have 378Gig on a Dos/Windows partition right now /dev/sda4

if you 'REALLY' want to delete everything on this partition...
sudo mkfs.ext4 /dev/sda4

That will delete everything on this partition and reformat it is a linux partition.

now you have to make Linux know about it.. and "mount" it.

mkdir /extra_space

This makes a "bookmark" place holder. A place for the filesystem to mount your disk.

mount /dev/sda4 /extra_space

This actually mounts your disk. But this only temporarily mounts it.

When you get this far. I can show how to make it permanent by adding this mount point
to your /etc/fstab file.
 
Hello mate and thanks for your time

It looks like you have 378Gig on a Dos/Windows partition right now /dev/sda4

if you 'REALLY' want to delete everything on this partition...
sudo mkfs.ext4 /dev/sda4

That will delete everything on this partition and reformat it is a linux partition.

yes im really looking to delete everything on it as i've already moved all the useful data to an external disk , while trying your first command i encountered a problem
Code:
aliyous@aliyous:~$ sudo mkfs.ext4 /dev/sda4
mke2fs 1.45.3 (14-Jul-2019)
/dev/sda4 contains a ntfs file system
Proceed anyway? (y,N) y
/dev/sda4 is mounted; will not make a filesystem here!
i checked it in files and its still all there , any clues ?
 
It says it's mounted, it won't let you format a mounted disk.

can you send the out-put of either "mount" or "df -h"
 
this one is for mount :
Code:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8086808k,nr_inodes=2021702,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1627532k,mode=755)
/dev/sda5 on / type ext4 (rw,noatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16568)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
/var/lib/snapd/snaps/snapd_6434.snap on /snap/snapd/6434 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_1668.snap on /snap/core18/1668 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-28-1804_116.snap on /snap/gnome-3-28-1804/116 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_209.snap on /snap/snap-store/209 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1440.snap on /snap/gtk-common-themes/1440 type squashfs (ro,nodev,relatime,x-gdu.hide)
/dev/sda6 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/120 type tmpfs (rw,nosuid,nodev,relatime,size=1627528k,mode=700,uid=120,gid=127)
gvfsd-fuse on /run/user/120/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=120,group_id=127)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1627528k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /run/user/1000/doc type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sda4 on /media/aliyous/F42CDF442CDF0092 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

and this is df -h :
Code:
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  2.1M  1.6G   1% /run
/dev/sda5        95G   40G   51G  44% /
tmpfs           7.8G  168M  7.6G   3% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/loop2       25M   25M     0 100% /snap/snapd/6434
/dev/loop1       55M   55M     0 100% /snap/core18/1668
/dev/loop0      161M  161M     0 100% /snap/gnome-3-28-1804/116
/dev/loop3       43M   43M     0 100% /snap/snap-store/209
/dev/loop4       45M   45M     0 100% /snap/gtk-common-themes/1440
/dev/sda6       1.4G  103M  1.3G   8% /boot/efi
tmpfs           1.6G   24K  1.6G   1% /run/user/120
tmpfs           1.6G   68K  1.6G   1% /run/user/1000
/dev/sda4       378G  130G  249G  35% /media/aliyous/F42CDF442CDF0092
 
Do this first.

sudo umount /media/aliyous/F42CDF442CDF0092

Then run the mkfs.ext4 command above.
 
alright it worked !
discarding device blocks : done :)
sadly when i tried : mkdir /extra_space i was responded with :
mkdir: cannot create directory ‘/extra_space’: Permission denied

should i try this as root ?
 
uugghh, sorry. Yes

sudo mkdir /extra_space
 
mount /dev/sda4 /extra_space

This actually mounts your disk. But this only temporarily mounts it.

When you get this far. I can show how to make it permanent by adding this mount point
to your /etc/fstab file.

so this is as far as i got :

Code:
aliyous@aliyous:~$ sudo mount /dev/sda4 /extra_space
mount: /extra_space: /dev/sda4 already mounted on /extra_space.

i tried the last bit 4 or 5 times i guess thats why its already mounted before .
now i just need your help to make it permanent :D
 
Sorry it took so long to get back.

Run this command first.

sudo blkid /dev/sda4

You will get an output similar to what is printed below. The UUID's will be different of course.

/dev/sda4: UUID="3a03c9db-1452-4e1c-90f4-0400b88c3d0f" TYPE="ext4" PARTUUID="76ee931a-05"

Only two things we really care about here are the UUID and the TYPE.

Either memorize them, (good luck :) ) or save them off someplace You can also copy and paste.

Now we need to edit a file. Most newbies are more at lease with pico than with vi/vim
So we will use that command. It's just a text editor, similar to notepad in windows.
The file we want to edit is /etc/fstab. So run this command.

sudo pico /etc/fstab

You will see something similar to this. It probably won't match exactly.

#
# /etc/fstab
# Created by anaconda on Mon Dec 23 22:43:06 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=09de7c1e-0aad-4878-9395-4883f6622e8e / ext4 defaults 1 1
UUID=9e580e14-f110-4186-8b44-9f08b4e05534 /boot ext4 defaults 1 2
UUID=2EB9-5DA9 /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
UUID=3a03c9db-1452-4e1c-90f4-0400b88c3d0f /home ext4 defaults 1 2
UUID=ef0d8f6b-9695-401e-b55a-38e7f9f9de07 /var xfs defaults 0 0
UUID=36a00a8b-d6f7-4ccc-9d1b-5f42e3eeedd8 /var/log ext4 defaults 1 2
UUID=7c14840d-1516-4a43-a39e-76ef39ebb0ed /var/log/audit ext4 defaults 1 2
UUID=310b38e0-cd0c-44af-838f-85d895853da9 none swap defaults 0 0

We want to add this at the bottom of this file.

UUID= (whatever your UUID for this partition is ) /extra_space ext4 defaults 0 0

Important: note that when you ran the blkid command above, there were quotes (") on
either side of the UUID. These quotes should be removed in the fstab file.

So the last line in your fstab file will look similar to this..

UUID=abcde123-456-abcd-1234-12345abcdef /extra_space ext4 defaults 0 0

(don't use the UUID I made up above) Use the one from the blkid command ouput.

Now save the file. That's it you are done. Now, next time you reboot that file system
will automatically be mounted.
 
...as a side note...

In the "old days" we used to mount devices based on their device path.

We used to put something like this is /etc/fstab

/dev/sda4 /extra_space ext4 defaults 0 0

But most documentation for newer distro's recommend using the UUID, instead of the device path.

Supposedly it's more reliable, faster, more secure... blah.. blah..

I don't know if all that is true, but they say it's recommended, so it's what I do.
 
hey dos2unix .
thanks for your help i really appreciate it .
i guess there are 2 ways of saving the changes
1 pressing ctrl+s ==> responds [ Error writing /etc/fstab: Permission denied ]
2 pressing ctrl+x then Y to save ==> same error

5576


the end is so close i can feel it :D
:D
 
did you use the "sudo" at the beginning of the command?

sudo pico /etc/fstab

If that still doesn't work... there is another way.
 
yes i used sudo

edit : whoops double checked it and sudo was missing !
i restarted my system and checked my partitions using sudo fdisk -l
the result is so depressing
Code:
Device         Start        End   Sectors  Size Type
/dev/sda1       2048    1085439   1083392  529M Windows recovery environment
/dev/sda2    1085440    1290239    204800  100M EFI System
/dev/sda3    1290240    1323007     32768   16M Microsoft reserved
/dev/sda4    1323008  794009599 792686592  378G Microsoft basic data
/dev/sda5  794009600  997326847 203317248   97G Linux filesystem
/dev/sda6  997326848 1000214526   2887679  1.4G EFI System
its like i never changed anything
 
Last edited:
should be good. try rebooting.

Then do df -h to check it.
 
should be good. try rebooting.

Then do df -h to check it.

it looks fine
Code:
aliyous@aliyous:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  2.1M  1.6G   1% /run
/dev/sda5        95G   40G   51G  44% /
tmpfs           7.8G  169M  7.6G   3% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/loop1       55M   55M     0 100% /snap/core18/1668
/dev/loop2      161M  161M     0 100% /snap/gnome-3-28-1804/116
/dev/loop0       25M   25M     0 100% /snap/snapd/6434
/dev/loop4       45M   45M     0 100% /snap/gtk-common-themes/1440
/dev/loop3       43M   43M     0 100% /snap/snap-store/209
/dev/sda6       1.4G  103M  1.3G   8% /boot/efi
/dev/sda4       372G   69M  353G   1% /extra_space
tmpfs           1.6G   24K  1.6G   1% /run/user/120
tmpfs           1.6G   56K  1.6G   1% /run/user/1000

sda4 is now extra_space :) yes

thank you so much my friend you are the best , could never do this without your help
 
@dos2unix
In the "old days" we used to mount devices based on their device path.

We used to put something like this is /etc/fstab

/dev/sda4 /extra_space ext4 defaults 0 0


as of 2020 my fstab :

bash-5.0$ cat /etc/fstab
/dev/sda2 swap swap defaults 0 0
/dev/sda3 / ext4 defaults 1 1
/dev/sda1 /boot/efi vfat defaults 1 0
#/dev/cdrom /mnt/cdrom auto noauto,owner,ro,comment=x-gvfs-show 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs nosuid,nodev,noexec 0 0


bash-5.0$
 

Staff online

Members online


Top