Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 4919  / 1 Year ago, tue, may 16, 2023, 7:13:29

Good evening everyone , I got a little issue with Swap Partitions. Due to some issues after installing Ubuntu first time, I reinstalled it and now I have 3 Swaps.
Here is sudo fdisk -l result



Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xaa9693fe

Device Boot Start End Blocks Id System
/dev/sda1 2048 52430847 26214400 1c Hidden W95 FAT32 (LBA)
/dev/sda2 * 52430848 540677076 244123114+ 7 HPFS/NTFS/exFAT
/dev/sda3 540678142 1465147391 462234625 5 Extended
Partition 3 does not start on physical sector boundary.
/dev/sda5 1452750848 1465147391 6198272 82 Linux swap / Solaris
/dev/sda6 1440352256 1452742655 6195200 82 Linux swap / Solaris
/dev/sda7 540678144 1427951615 443636736 83 Linux
/dev/sda8 1427953664 1440339967 6193152 82 Linux swap / Solaris


So Swaps in /dev/sda5 and /dev/sda6 are no longer in use as far as I understand and thus I was planning to delete them, however faced a problem.
What I did is download and burn Gparted Live CD and boot it up, tried to delete those partitions but I have no idea how to add 12GB unallocated memory to the existing OS partition in this case to /dev/sda7 Is there anyway I can delete 2 swaps and extend unallocated memory to /dev/sda7 partion?



Thank you in advance!


More From » swap

 Answers
2

I find using gparted much easier for this, since it shows the actual layout order for the partitions. Using gparted, I would probably delete sda8 and sda6, and leave sda5, which is already at the end, and edit fstab to use sda5. Then it's easy to grow sda7 to use the space above it that was being used by the swap drives.



To edit /etc/fstab is not hard; if you don't know how, I can tell you the details, but the basic drill is to run sudo blkid -c /dev/null in a terminal to get a list of all the UUIDs. The addition of the "-c /dev/null" just insures that it doesn't use a cache, so you get any recent changes. Once you get the UUID for sda5, simply substitute it for the existing on in your fstab file. You will need to edit it using sudo, and a text editor such as gedit or vim.



Lines starting with "#" are comments. The line to change will look something like this:



# swap was on /dev/sda8 during installation



UUID=000-0000-0000-0000-00000000 none swap sw 0 0.



The UUID (shown as all zeros) is made up of hexadecimal digits (the letters A-F, plus numbers). The results of blkid will look similar



To delete the swap file, you may need to disable it (right-click and select swapoff in gparted).



EDIT: More details for user.



You will need to use a live CD with gparted. Either the gparted lived CD or the install CD will work. It's pretty easy, actually. The first thing to do after running gparted is to select your disk drive in the upper-right, if it's not shown. It may be



You will see a representation of your disk layout at the top of the window. You should have all 3 swap drives at the end, on the right, labeled sda8, sda6, sda5. The numbering isn't by position. To grow sda7, you need to have space adjacent to it, so you will not delete the swap drive furthest to the right.



All you have to do is click on the partition, either on the top graphic, or the list below. The swap drive will say "Linux-swap" in the column for File System, and there's really no danger of deleting the wrong swap drive, unless you're really low on memory, possibly. In fact, I just discovered my swap drive has been disabled for a while.



So, right-click on each of the two near, but not at, the end (leave the one at the end) and select "Swapoff". You should then be able to delete them when you right-click. Then, right click on the main sda7 partition, and select "resize/move", and then grab the right-hand side and drag it as far to the right as you can.



This doesn't do anything yet. You have to select "Apply all operations" from the Edit menu, or click the checkmark toolbar button. That's it.


[#39320] Wednesday, May 17, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dresuitable

Total Points: 69
Total Questions: 116
Total Answers: 122

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
dresuitable questions
Sat, May 15, 21, 04:38, 3 Years ago
Fri, Apr 14, 23, 09:53, 1 Year ago
Tue, May 16, 23, 18:13, 1 Year ago
Sun, Apr 24, 22, 12:59, 2 Years ago
;