LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 04-12-2024, 08:45 PM   #16
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923

Let me try to explain a bit more. Your VM is configured using the legacy MBR partitioning, you have a primary partition sda1, an extended partition sda2 and within the extended partition a logical partition which is your swap. The extended / logical partitioning scheme was developed so that in the old days one could create more then 4 partitions. 1-4 are primary and anything >=5 is a logical partition.

What you have in https://imgur.com/cgyjeje image is resized the extended partition to include the added space and are moving sda5 within sda2 which is incorrect.

Lets try it again:
1. Move sda5 back to the beginning of sda2.
2. Resize sda2 back to the original size, basically the same as sda5.
3. Move sda2 to the end of the drive. This should move the unallocated space from the extended partition back to where it should be.
4. Resize sda1 to include the unallocated space.
 
1 members found this post helpful.
Old 04-12-2024, 08:45 PM   #17
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
I also wanted to provide a summary of fdisk -l output before and after changes causing the start & end sectors to change on /dev/sda2

fdisk -l before any changes:

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 56719359 56717312 27G 83 Linux
/dev/sda2 56721406 58718207 1996802 975M f W95 Ext'd (LBA)
/dev/sda5 56721408 58718207 1996800 975M 82 Linux swap / Solaris

fdisk -l after todays' any changes:

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 56719359 56717312 27G 83 Linux
/dev/sda2 56721406 75315199 18593794 8.9G f W95 Ext'd (LBA)
/dev/sda5 73318400 75315199 1996800 975M 82 Linux swap / Solaris

I'm assuming I want to try to change the Start and End sectors of /dev/sda2 back to how they were before any of the changes were made?

Either way I'd rather not have to remove the /swap to try to fix this because that might cause issues and I confirmed my swap is working fine right now.
Code:
Disk /dev/sda: 35.91 GiB, 38561972224 bytes, 75316352 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd75cca19

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048 56719359 56717312   27G 83 Linux
/dev/sda2       56721406 58718207  1996802  975M  f W95 Ext'd (LBA)
/dev/sda5       56721408 58718207  1996800  975M 82 Linux swap / Solaris

└─$ df -lh
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           594M  1.1M  593M   1% /run
/dev/sda1        27G   22G  4.1G  85% /
tmpfs           2.9G     0  2.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           594M  2.6M  591M   1% /run/user/1000
 
Old 04-12-2024, 08:47 PM   #18
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
I responded to your thread while you were adding a post. See my post #16 but yes you want to resize sda2 back to where it was before.
 
Old 04-12-2024, 09:17 PM   #19
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by michaelk View Post
I responded to your thread while you were adding a post. See my post #16 but yes you want to resize sda2 back to where it was before.
I just noticed your response and I'm trying to do this.LOL <sigh>
I was thinking trying these operations with KDE Partition manager withing the Guest OS. This looks like it will basically put it back to how it was originally. I have not committed this yet but see what you think? I'm not sure if I could change the 1MB unallocated that would end up on sda2 but the sda5 would be back at the top this way. I could possible zero out that extra 1 MB some how.

https://imgur.com/O6S4eLS
 
Old 04-12-2024, 09:24 PM   #20
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
I would not worry about the 1mb space.
 
Old 04-12-2024, 09:45 PM   #21
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by michaelk View Post
I would not worry about the 1mb space.
Ok, I went ahead and committed those changes in KDE partition mgr. I won't worry about that 1MB that ended up on sda2.

Quote:
3. Move sda2 to the end of the drive. This should move the unallocated space from the extended partition back to where it should be.
However, I'm unable to move the /dev/sda5 to the right if this is what you mean by the statement above. I have yet to try the live gparted option again.

Unable to mode this /sda2 Resize/Move.
https://imgur.com/0vWumWg

Thanks!
 
Old 04-12-2024, 09:54 PM   #22
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
No you need to move sda2. It seems you are running the VM and not the gparted ISO. gparted will not allow you to move active partitions. You could turn swap off and then try to move sda2 but I would go back to running gparted ISO.
 
Old 04-12-2024, 10:07 PM   #23
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by michaelk View Post
No you need to move sda2. It seems you are running the VM and not the gparted ISO. gparted will not allow you to move active partitions. You could turn swap off and then try to move sda2 but I would go back to running gparted ISO.
Ok, I booted back with the ISO attached to the VM. I'm basically back to square one and going in circles. I'm still assuming I need to move Resize/Move the /dev/sdc2 to the far right but it's now unable to be moved around. Perhaps I'll have more luck tomorrow?

https://imgur.com/UQS8Ypg

Thanks again for all the help. This has been frustrating as heck and I never remember running into so many issues!
 
Old 04-12-2024, 10:17 PM   #24
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Also, I went ahead and restored my snapshot to before I messed with this at all just to get back to exactly how it was before trying anything.
Hope to get this figured out tomorrow!

The sectors are back to my very first post ,etc.
 
Old 04-12-2024, 10:35 PM   #25
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,740

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Sorry, I've totally messed you up and posted the wrong steps.

1. resize the extended partition to include the entire unallocated space.
2. move sda5 to the end of the extended partition.
3. move the start of the extended partition to the right. This will essentially move the unallocated space to right after sda1.
4. resize sda1 to now use the unallocated space.
 
Old 04-13-2024, 07:57 AM   #26
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Your setup seems unusual as I can't think of a good reason to have an Extended partition on a drive when you are only using 2 partitions. I don't know if this is how your installer created things or if you did but it is much simpler if you only have 2 partitions that they be primary as you have found.

Another possibility in addition to the post above would have been to use gparted and turn off swap using the terminal tab, delete swap then delete sda2 (Extended partition), increase the size of sda1 leaving 1-2GB for a primary swap partition. You would need to modify the entry in the /etc/fstab file for swap and insert a correct device name or UUID as creating a new swap changes the UUID.

Last edited by yancek; 04-13-2024 at 08:17 AM.
 
1 members found this post helpful.
Old 04-13-2024, 09:23 AM   #27
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by yancek View Post
Your setup seems unusual as I can't think of a good reason to have an Extended partition on a drive when you are only using 2 partitions. I don't know if this is how your installer created things or if you did but it is much simpler if you only have 2 partitions that they be primary as you have found.

Another possibility in addition to the post above would have been to use gparted and turn off swap using the terminal tab, delete swap then delete sda2 (Extended partition), increase the size of sda1 leaving 1-2GB for a primary swap partition. You would need to modify the entry in the /etc/fstab file for swap and insert a correct device name or UUID as creating a new swap changes the UUID.
LOL, I just checked back after using my new approach this morning and you're statement is pretty much what I did! Yeah, I told the installer to do basic setup and recommended this swap setup. I used to always allocate my own file system for / , /home , /swap. The extended partition was preventing me from merging the unallocated space. Here's my steps I did and some screen shots. I'm still testing but it appears good now aside from what appears to be a slight slowdown on boot up I didn't notice before. I don't think I'll revert back to my snapshot unless I notice any issues after a few days of testing.

OFFICIAL PARTITION FIX
Links referenced:
https://askubuntu.com/questions/1751...-using-gparted
https://jochenhebbrecht.be/site/2016...t#comment-7080

Action Plan:

1) Deactivate Swap with KDE Manager
2) Disable swap by commenting out the UUID in /etc/fstab
3) Boot off gparted Live and delete the swap and apply changes
4) Delete the extended /dev/sda2 partition and apply
5) This left me with only two file systems > the /dev/sda1 that I wanted to expand and 8.87 GB of unallocated space
6) Resize the unallocated space leaving the amount you want to use for a /swap file
7) Right click on remainder (975 MB in my case) and assign it linux-swap files system within gparted
8) You can probably re-activate the swap with the live gparted but I ended up booting without swap active without issues but the first boot was noticebly slower.
9) Open KDE-Partition manager (If installed) > I added plasma desktop manager with XFCE so I think KDE desktop installed this utility. Right click on swap and choose swap on.
10) Identify the new UUID for the swap via the commands listed below.
11) Remote the comment out # from the beginning of the /etc/fstab for the /swap file and input the new UUID
12) Reboot and confirm swap is active using the new UUID for the swap.

Things noticed. The UUID for my swap file did change as part of this process.
It might be a better idea to activate the swap within the gparted live ISO session but I did not do this. However, I now have the extra space I wanted allocated so I'm not going to bother messing with this. However, I have noticed a slight hang when my VM boots up but it seems to be up and running fine.
I'll monitor this to check. I attached a few screen shots that might help someone with this issue in the future. It was a PITA but after spending an entire day I was able to get this sorted.
Swap file UUID before doing this was:
└─sda5 975M part 81fd0e88-7b42-461f-99da-7484c7d58db5
Swap file UUID after doing this:
└─sda2 974M part 48d0c546-938b-4489-87de-371af43496f4
Note: Theses commands will get you the UUID of the swap.
lsblk --output NAME,SIZE,TYPE,UUID
lsblk --output NAME,SIZE,FSTYPE,UUID | grep '[[:space:]]swap[[:space:]]'
Happy Days!

Pictures:
https://imgur.com/kiofHW9
https://imgur.com/OeHb4tb
https://imgur.com/aiMoI8a
https://imgur.com/J3U1G5x
 
Old 04-13-2024, 08:21 PM   #28
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
What's odd is ever after some more testing the OS loading logo is slower on startup. It used to only flash for about 1-2 seconds. Now it's more like 6-10 seconds which is annoying. I even restored my snapshot just to confirm it loaded faster with the swap and partition setup from before by loading my old snapshot. But I confirmed the snap file is definitely activated and in use so I suppose I can deal with that slight annoyance.
 
Old 04-14-2024, 07:54 AM   #29
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Quote:
I told the installer to do basic setup and recommended this swap setup.
Why not use the entire drive in that case rather than 75% of the drive with the / filesystem plus swap. Were you going to create another partition there?

Can't help with the slower boot as I haven't used Mint in years but I'd agree it is more an annoyance than a problem.
 
Old 04-14-2024, 09:44 AM   #30
NuxIT
Member
 
Registered: Jul 2003
Location: Westminser, CO
Distribution: xUbuntu
Posts: 137

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by yancek View Post
Why not use the entire drive in that case rather than 75% of the drive with the / filesystem plus swap. Were you going to create another partition there?

Can't help with the slower boot as I haven't used Mint in years but I'd agree it is more an annoyance than a problem.
I just discovered I do have an issue with my swap file. I just changed the UUID to match and it shows my swap as active but I believe it's causing the boot hang.
Here's my dmesg showing this issue.

dmesg |grep edc1bdec-bbbb
[ 41.139375] systemd[1]: Expecting device dev-disk-by\x2duuid-edc1bdec\x2dbbbb\x2d4830\x2d81d8\x2d0f4a94bc74cf.device - /dev/disk/by-uuid/edc1bdec-bbbb-4830-81d8-0f4a94bc74cf..

Running all these commands show the swap is being used.

swapon -s to see swap devices and sizes (where swapon is installed)

Code:
└─$ swapon -s
Filename                                Type            Size            Used            Priority
/dev/sda5                               partition       1052668         0               -                                                            CONFIRMED SWAP was activated!
in dmesg >>d

[/etc]
└─$ lsblk --output NAME,SIZE,TYPE,UUID
NAME    SIZE TYPE UUID
sda    35.9G disk 
├─sda1 34.9G part 
├─sda2    1K part 
└─sda5    1G part edc1bdec-bbbb-4830-81d8-0f4a94bc74cf
sr0    1024M rom  
sr1      51M rom  2024-01-15-14-48-13-93

sblk --output NAME,SIZE,FSTYPE,UUID | grep '[[:space:]]swap[[:space:]]'
└─sda5    1G swap    edc1bdec-bbbb-4830-81d8-0f4a94bc74cf
And here's my /etc/fstab where I just changed the UUID to match what's showing in the output above. (edc1bdec-bbbb-4830-81d8-0f4a94bc74cf)
It looks like it's pointing to the wrong location but still loading somehow?

/etc/fstab shows> I added the new UUID.

Code:
# swap was on /dev/sda5 during installation
UUID=edc1bdec-bbbb-4830-81d8-0f4a94bc74cf none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
Appreciate any help getting the correct information inputted into this!

Last edited by NuxIT; 04-14-2024 at 10:56 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cannot extend c:\win on dualboot as no unallocated space nextdoor partition, extend is greyed out on disk mgt, cyno77 Linux - Newbie 68 05-15-2021 09:11 PM
[SOLVED] virtualbox is installed along with virtualbox-dkms and virtualbox-ext-pack and linux-headers-generic, but error for no /dev/vboxdrv Astral Axiom Linux - Software 2 03-04-2019 08:09 PM
Extend Linux Partition (Extend LVM) osama.mansoor Linux - Newbie 5 11-27-2015 01:09 AM
[SOLVED] Extend partition in Virtualbox machine lee_can Linux - Newbie 6 01-13-2014 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration