Help needed: Resize a Linux Mint 17 partition [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
tbochan
Level 1
Level 1
Posts: 3
Joined: Tue Jun 03, 2014 7:45 pm

Help needed: Resize a Linux Mint 17 partition [SOLVED]

Post by tbochan »

Solution summary:
1. Use the Live CD/Usb Gparted for repartitioning.
2. If the partition to be resized is 'extended' and contains a Linux Swap logical partition,
select Swapoff before attempting to resize, otherwise Gparted will not allow you to resize the extended partition.
After resizing, select Swapon for the Swap partition.
----------------------------------------------------------------------------------------------------------
Hi, I need some advice on how to increase the size of the Linux parition.

I have 2 x 120GiB disks and dual boot Windows7/LinuxMint17(Cinnamon)

After installing Mint 17 Cinnamon, this is the arrangement I arrived at using defaults where possible :

=====================================
(parted) print list,all
Model: ATA KINGSTON SV300S3 (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 106MB 105MB primary ntfs boot
2 106MB 120GB 120GB primary ntfs

Model: ATA KINGSTON SMS200S (scsi)
Disk /dev/sdb: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 100GB 100GB primary ntfs
2 100GB 120GB 20.0GB extended
5 100GB 112GB 11.5GB logical ext4
6 112GB 120GB 8501MB logical linux-swap(v1)
=====================================

The system is working beautifully except that I had obviously made the Linux partition too small,
and have plenty of space for resizing, but I'm not sure what to do to avoid screwing things up,
and having to reinstall everything again.

I used the Live Usb to run Gparted and decreased #1 of /dev/sdb to 60MiB ok with Gparted resize option,
however when I then tried the same with #5, it did not allow me to use the space I had just released.
I didn't want to 'experiment' too much so I restored the scenario to its original,
and thought I would get advice from someone who knows what they are doing.

Regards,
Last edited by tbochan on Tue Jun 17, 2014 2:04 pm, edited 2 times in total.
User avatar
Reorx
Level 12
Level 12
Posts: 4031
Joined: Tue Jul 07, 2009 7:14 pm
Location: SE Florida, USA

Re: Help needed: Resize a Linux Mint 17 partition

Post by Reorx »

You will have to enlarge sdb2 before you can enlarge sdb5 (sdb5 and sdb6 are contained within sdb2). It is possible to bork your system by resizing partitions in a functioning system... it is fixable with a few terminal commands but that is beyond my (at my fingertips) experience level... though I am sure a local terminal guru will come along to help out with those details...
Full time Linux Mint user since 2011 - Currently running mostly LM19C and a little LM20C.

Image Image Image
User avatar
austin.texas
Level 20
Level 20
Posts: 12046
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Help needed: Resize a Linux Mint 17 partition

Post by austin.texas »

Since you decreased the size of sdb1 to 60GB, you now have about 40GB of unallocated space.
There is more than one way to approach it, but here is what I would do.
The first step is to download and burn a Rescatux CD, which you will need to complete this operation.
Rescatux CD: A tool everyone should have (includes SuperGrub2 and gparted) - http://www.supergrubdisk.org/

Then use gparted on your live USB to Copy the Mint / partition (sdb5), and Paste into the unallocated space. Then delete sdb5 IMMEDIATELY. That is important because the original and the copy will both have the same UUID, and that could cause problems if you don't fix it before you boot.
Also, delete the swap partition with gparted, (turn swapoff first - using gparted). Then delete sdb2, the extended partition.

That will leave you with the 60GB partition, the 11.5GB partition, and about 50GB of unallocated space. You can then create your /home and swap partitions there. You can increase the size of the 11.5GB partition, but it is not really necessary, if you set up a separate /home partition.

Then close gparted, and boot the Rescatux CD.
When Rescatux starts you will get a menu to start Rescatux or SuperGrub2. The SuperGrub2 option is the one you want. After chosing SuperGrub2, the next menu will give the option of booting any installed operating system on your computer, including the Mint on sdb2. It will create a menu for you that will allow you to boot into Mint. It will be a slow process to search your drives and create that menu, so be patient and let it complete.
Then after you boot into Mint, run the two commands to fix GRUB
sudo update-grub
sudo grub-install /dev/sdb

The only remaining thing is to set up your /home partition to mount at boot, either as /home or just as a /data partition. Please ask if you need help with that.
If you want to test the Rescatux CD to assure yourself that it will boot Mint for you, try it out before you do anything else. You will see that it works!

I just described what I would do - simply because I have a preference for using primary partitions instead of extended. You could just leave the partitions as they are and create a /home partition in the unallocated space that you have now. 11.5GB is enough for a root partition, if you manage it correctly.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
usbtux
Level 5
Level 5
Posts: 974
Joined: Tue Dec 28, 2010 10:37 am

Re: Help needed: Resize a Linux Mint 17 partition

Post by usbtux »

There are several of ways to do this.
following Reorx -
Expand the extended partition
move the ext4 partition to the left
expand the swap partition (you only need slightly larger than the amount of ram you have installed)
Expand the ext4 to fill the remaining unallocated space.
Done - easy.
austin.texas's post works well but seems a whole lot of work for you, but, that's how he likes to set it up :)

I Would suggest backing up your home, delete your linux partitions and reinstall. Then drop your backed up home into your new home.
http://goo.gl/DXKgM LinuxMint tutorials.
Running LinuxMint 17.3 Mate. Pepermint 6 & Manjaro 15.12 Capella XFCE
http://goo.gl/WFu0u Installing Mint - the screen cast videos.
linuxcounter #368850
tbochan
Level 1
Level 1
Posts: 3
Joined: Tue Jun 03, 2014 7:45 pm

Re: Help needed: Resize a Linux Mint 17 partition

Post by tbochan »

Hi, Thanks for ther responses. very much appreciated.

@usbtux : Moving the ext4 partition to the left was what I was having difficulty with. Its what I tried to do at first.
Gparted wouldn't allow me, or I didn't know how to persuade it to do so,
even though I had shrunk the ntfs partition that was on the left of it.
Is there something about extended partitions that prevent them being extended to the left ? Or am I just experiencing finger probs ?
If it is possible, then that is what I would prefer to do.

What I have understood so far ( from austin,texas) is that I have 2 choices :

Option 1.
Create a new ext4 partition at the end of the primary ntfs and occupy it with my home folder,
and persuade it to be automatically mounted. (I would appreciate help with that).
I presume I need to create links to the new partition.
Thus leaving the Linux & Swap partitions where they are, in the extended partition.
So I will have :
1: ntfs
3: ext4 (Home+)
2: extented.
5: ext4 Linux
6: Linux Swap

Option 2.
Create a new ext4 partition at the end of the primary ntfs and copy/paste the Linux partition into it,
( it will appear as sdb3 ?)
remove the original Linux and Swap partitions (sdb5 & sdb6) and then the extended partition, sdb2.
Extend sdb3 to occupy the space released by sdb2(sdb5 & sdb6),
and create a new swap partition, leaving me with 3 primary partitions,
!:ntfs
2:ext4/Linux
3:ext4/Swap
Use SuperGrub2 to fixup the Grub menu.
(I hope I have understood this ok)

I'm not sure I have the confidence to proceed with option 2, although the result looks appealing.
(I will create myself a Rescatux CD in any case, it sounds good, though not in polite conversation :roll: )
Option 1 leaves me with partitions which I can't extend, but it seems to be the safest way.

If I go for re-installing ( I need contingency !) whats the best backup/restore strategy in Linux ?
Ceilidh2
Level 4
Level 4
Posts: 282
Joined: Thu Apr 17, 2014 10:29 pm
Location: Thames, New Zealand

Re: Help needed: Resize a Linux Mint 17 partition

Post by Ceilidh2 »

In Gparted, to move the partition to the left, set the first box to zero and set the second box to a number bigger than the total of your existing partition plus the unallocated space. Gparted will do the sums for you and set the partition to it's maximum possible size.

At least it did for me. Of course you must be running Gparted from your Live DVD/USB stick. You will need to be patient. It took an hour for Gparted to rewrite the entire partition for me.

Do you still have all your data backed up? I created a Data partition of about 100 GiG on sda3 (Gparted just named it that after I had created it) that is as big as my 120 GiG hard drive minus Root which I set at 10 GiG (you may need a little more than that for Cinnamon) and Swap, which I left in sda5, which is inside sda2 as Dallas Texas pointed out. Having Swap in sda5 is the default installation for the MATE desktop I use, and sda2 only needs to be as big as sda5. Why they do it that way I have no idea, I'm just a newbie.

I followed the instructions in Gold Finger's tutorial here: http://community.linuxmint.com/tutorial/view/1609

I created my Data file in /home (as /home/Data) and it works brilliantly. Then reinstall your data.

I don't understand why Dallas Texas, splendid and most helpful fellow though he is, wants to be so complicated. I had 17 MATE already installed when I created my Data partition, and nothing bad happened. My entire system now consists of Root on sda1, Data on sda3 and Swap on sda5/sda2. That's it.

I guess what you do with your second drive is entirely up to you.
Last edited by Ceilidh2 on Mon Jun 16, 2014 4:43 pm, edited 3 times in total.
"Take it easy, but take it." Woody Guthrie
Don_Pedro
Level 4
Level 4
Posts: 226
Joined: Sun Jun 23, 2013 11:54 am
Location: Dominican Republic

Re: Help needed: Resize a Linux Mint 17 partition

Post by Don_Pedro »

Ceilidh2, hi !
your link has a problem http://community.linuxmint.com/tutorial/view/1609,

Forum users need to remove the ,


that 's the right link : http://community.linuxmint.com/tutorial/view/1609

Cordially
P.
Mint 17 "Qiana", Cinnamon 64-bit 2.0.14 Kernel 3.13.0-27-generic x86_64 Dual Boot W8
Toshiba Satellite Satellite L50D-B Ram:8 GB Quad core AMD A6-6310 APU with AMD Radeon R4 Graphics Firefox/Thunderbird inxi Fxz File
User avatar
austin.texas
Level 20
Level 20
Posts: 12046
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Help needed: Resize a Linux Mint 17 partition

Post by austin.texas »

tbochan wrote: Option 2.
Create a new ext4 partition at the end of the primary ntfs and copy/paste the Linux partition into it,
( it will appear as sdb3 ?)
This is not correct. You do not create a new ext4 partition in the unallocated space you have now. You Copy the 11.5GB / partition and Paste into the unallocated space.
Ceilidh2 wrote: You will need to be patient. It took an hour for Gparted to rewrite the entire partition for me.
That is why I use Copy and Paste, then Delete - because it is much faster.

tbochan, your Option 1 is by far the quickest and easiest, and will work just fine.
You already know how to create the ext4 partition, using the unallocated space you have now. The only thing that remains is to mount it at boot time so that you can use it for your personal files.
I will give you a quick idea of the two options you have for that.
1) Use that partition as /home
2) Use that partition for data storage, not /home.
Each of those has pros and cons.
Setting it up as /home is a bit more complicated, considering your current setup, and I don't see any advantage to you in doing that.
Using it as data storage for all your personal files is quite simple.
1) Create the ext4 partition.
2) Boot into Mint on the hard drive and open a terminal
3) To mount the partition, you need a "mount point", so enter the command - mkdir $HOME/DataPartition (It does not need to be "DataPartition", it can be any name you chose.) All you are doing is creating a directory, or folder, in /home/yourusername/ to use as a "mount point"
4) Enter this command in the terminal - sudo blkid -o list That will give you info on your partitions including the UUID number of the new ext4 partition. You need that number so make a note of it somewhere.
5) Open the text file /etc/fstab in your gedit text editor with this command - gksudo gedit /etc/fstab
6) Enter these two lines at the end of the text file -

Code: Select all

# mount data partition on /home/yourusername/DataPartition
UUID=a299e544-0371-4856-912b-70458aa37ee1   /home/yourusername/DataPartition   ext4   defaults,noatime   0   2
Replace the UUID number with the correct one, and use the correct name of the DataPartition mount point, and yourusername.
7) Save and exit the text editor
8 ) Enter this command - sudo mount -a

That's it. You are done. Now you can create folders on the new partition, and move your music, videos, and documents there.
You can create bookmarks in your file manager (Nemo) for direct access to any of those folders, if you want to.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
Reorx
Level 12
Level 12
Posts: 4031
Joined: Tue Jul 07, 2009 7:14 pm
Location: SE Florida, USA

Re: Help needed: Resize a Linux Mint 17 partition

Post by Reorx »

tbochan wrote:... Is there something about extended partitions that prevent them being extended to the left ? Or am I just experiencing finger probs? If it is possible, then that is what I would prefer to do...
tbochan;

If your Live medium boot is using your on disk swap partition (sdb6), then it has to mount the extended partition (sdb2) and the swap partition (sdb6)... Gparted will not allow/perform any manipulations on mounted partitions... If your swap is mounted, you will have to unmount swap (sdb6) and unmount the extended partition containing swap (sdb2) before you can do any manipulations on the extended partition (sdb2). On the Gparted menu bar, select Partition > Unmount. Once everything is unmounted, you should have no difficulty resizing sdb2...

Good luck and Enjoy the Mint! :mrgreen:

<To tell which partitions are mounted in Gparted, look for the icon hilighted below - it indicates that the partition is mounted>
swap.png
Full time Linux Mint user since 2011 - Currently running mostly LM19C and a little LM20C.

Image Image Image
tbochan
Level 1
Level 1
Posts: 3
Joined: Tue Jun 03, 2014 7:45 pm

Re: Help needed: Resize a Linux Mint 17 partition

Post by tbochan »

Problem solved.
Thanks to you all for your time.
I think I learned a lot in the process without creating a disaster for myself.

My new layout is :
Model: ATA KINGSTON SMS200S (scsi)
Disk /dev/sdb: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 78.1GB 78.1GB primary ntfs
2 78.1GB 120GB 41.9GB extended
5 78.1GB 112GB 33.4GB logical ext4
6 112GB 120GB 8501MB logical linux-swap(v1)

The problem was that Gparted would not allow me to resize the extended partition (sdb2) because the SWAP flag on the Swap partition (sdb6)
was on. I selected SWAPOFF in Gparted, and was then able to resize with no problem.
After resizing, I selected SWAPON, and then everything was sweet as a nut ! You live and learn.
(btw, I made a reference earlier to Rescatux CD, where , because of the font and my eyesight, I misread the T for an F in the name)

Until next time,
best regards.
User avatar
austin.texas
Level 20
Level 20
Posts: 12046
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Help needed: Resize a Linux Mint 17 partition

Post by austin.texas »

I am glad you got it worked out !
Please go to your first post, click EDIT, and add [SOLVED] to the title.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Post Reply

Return to “Newbie Questions”