Author Topic: How to change the size of partitions? (resolved)  (Read 3321 times)

0 Members and 1 Guest are viewing this topic.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
How to change the size of partitions? (resolved)
« on: January 06, 2013, 06:54:52 pm »
I have a main drive of 160GB however, my file system is only 77GB and I am running out of space.  The remaining 84GB Extended partition consists of a 73GB ext4 partition and 2 Linux swap files one of 4.3GB and another of 6.5GB.

Thus 73GB is not being used by the file system how do I increase the size of the file system partition?

I am using mint 13 64bit.
« Last Edit: January 16, 2013, 05:56:04 pm by Tramlink »

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #1 on: January 06, 2013, 08:52:19 pm »
Any reason you have 2 swap partitions ?

You can use gparted resize the partitions .. but be sure to have a LiveCD/LiveUSB handy in case the UUID's of the partitions change and the system becomes unbootable.

[EDIT]

See my next posting.

.
« Last Edit: January 06, 2013, 09:07:16 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #2 on: January 06, 2013, 09:06:31 pm »
Come to think of it, you'll need a LiveCD/LiveUSB anyway ... because you'll need to boot to it to run gparted .. you CANNOT resize mounted partitions.

So you'll need to boot to a LiveCD/LiveUSB, THEN use gparted to resize the partitions
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #3 on: January 07, 2013, 09:14:48 am »
I have no clue why I have two swap files is there any way to find out if I can remove one of them?  What are the UUID's is it rhe same as the boot record?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #4 on: January 07, 2013, 03:28:40 pm »
Quote
I have no clue why I have two swap files is there any way to find out if I can remove one of them?

As long as you don't dual boot 2 Linux distros ..

YES .. post the contents of:
Code: [Select]
gedit /etc/fstab

and the output from:
Code: [Select]
sudo fdisk -l
and
Code: [Select]
sudo blkid

And we can work out which one you must keep

Code: [Select]
What are the UUID's is it rhe same as the boot record?

NO .. there are 2 ways of defining a partition in fstab.

a) by its "device" .. /dev/sdXY
or
b) by ts UUID (Universally Unique IDentifier) .. a long string of numbers and letters, that you'll see from the "blkid" command.

UUID's are what are used (now) by default .. and rearranging partitions *shouldn't* change the UUID so fstab entries *should* still work .. that said, occasionally they do change .. and require you to edit fstab, or reinstall the GRUB bootloader.
(Don't panic .. we can easily sort this if it happens)
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #5 on: January 08, 2013, 10:14:15 pm »
Read outs as requested. The system is Duel boot with Win XP on a separate hard disk Named clive1.  There is only one Linux mint 13 on the second hard disk.

When mint was installed it only used 50% of the available hard disk space why did it not use all available space?

/etc/fstab: static file system information.
#
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdb7 during installation
UUID=4d9cd1eb-9ff2-4fc3-878e-21bc3134853b /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb5 during installation
UUID=b9b68dc9-f641-402a-9162-a302820398db none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0


 sudo fdisk -l
[sudo] password for userone:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa970a970

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   312576704   156288321    b  W95 FAT32

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00031f7b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    82812927    41405440   83  Linux
/dev/sdb2       149481470   312580095    81549313    5  Extended
/dev/sdb5       299810816   312580095     6384640   82  Linux swap / Solaris
/dev/sdb6       291424256   299804671     4190208   82  Linux swap / Solaris
/dev/sdb7       149481472   291422207    70970368   83  Linux

Partition table entries are not in disk order

~ $ sudo blkid
/dev/sda1: LABEL="CLIVE1" UUID="3B0D-1C00" TYPE="vfat"
/dev/sdb1: UUID="613e9e0e-6a78-4046-bee5-3b498c55cbe7" TYPE="ext4"
/dev/sdb5: UUID="b9b68dc9-f641-402a-9162-a302820398db" TYPE="swap"
/dev/sdb6: UUID="2406e6c0-e8a3-4a99-84c9-0270bcf7858a" TYPE="swap"
/dev/sdb7: UUID="4d9cd1eb-9ff2-4fc3-878e-21bc3134853b" TYPE="ext4"

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #6 on: January 09, 2013, 12:18:13 am »
Quote
When mint was installed it only used 50% of the available hard disk space why did it not use all available space?

Because you already had another version of Linux on the drive (and still do) .. so it used the largest available single block of space.

IF you only want the one version of Linux (the one that fstab came from), you can delete the sdb1, and sdb6 .. resize the extended partition to be just big enough to contain sdb5 (swap) .. move sdb5 and the extended partition to the beginning of the drive .. then resize sdb7 to fill the rest of the drive.

BUT

This WILL break the bootloader .. leaving both Windows on sda1 and Linux on sdb7 unbootable .. so you'll need to reinstall GRUB

If you have any questions .. ask them now ;) .. and make sure you have a LiveUSB of the same version of Linux you are keeping.

[EDIT]

Actually, before you go any further .. can you send the contents of:
Code: [Select]
gedit /boot/grub/grub.cfg
when posting the contents, can you be sure to surround it with code tags (to preserve formatting).
« Last Edit: January 09, 2013, 12:23:26 am by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #7 on: January 09, 2013, 10:20:04 am »
Quote
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd1,msdos7)'
search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd1,msdos7)'
  search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
  set locale_dir=($root)/boot/grub/locale
  set lang=en_GB
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
   set gfxpayload="${1}"
   if [ "${1}" = "keep" ]; then
      set vt_handoff=vt.handoff=7
   else
      set vt_handoff=
   fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'LinuxMint, with Linux 3.2.0-23-generic' --class linuxmint --class gnu-linux --class gnu --class os {
   recordfail
   gfxmode $linux_gfx_mode
   insmod gzio
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos7)'
   search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
   linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=4d9cd1eb-9ff2-4fc3-878e-21bc3134853b ro   quiet splash $vt_handoff
   initrd   /boot/initrd.img-3.2.0-23-generic
}
menuentry 'LinuxMint, with Linux 3.2.0-23-generic (recovery mode)' --class linuxmint --class gnu-linux --class gnu --class os {
   recordfail
   insmod gzio
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos7)'
   search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
   echo   'Loading Linux 3.2.0-23-generic ...'
   linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=4d9cd1eb-9ff2-4fc3-878e-21bc3134853b ro recovery nomodeset
   echo   'Loading initial ramdisk ...'
   initrd   /boot/initrd.img-3.2.0-23-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_lupin ###
### END /etc/grub.d/10_lupin ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos7)'
   search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
   linux16   /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
   insmod part_msdos
   insmod ext2
   set root='(hd1,msdos7)'
   search --no-floppy --fs-uuid --set=root 4d9cd1eb-9ff2-4fc3-878e-21bc3134853b
   linux16   /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" --class windows --class os {
   insmod part_msdos
   insmod fat
   set root='(hd0,msdos1)'
   search --no-floppy --fs-uuid --set=root 3B0D-1C00
   drivemap -s (hd0) ${root}
   chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

As requested.

I am only offered one version of Linux at the boot menu and that is mint 13 I thought it had over written the other version of Linux.

I have a Live DVD of mint 13 64bit Mate which is the Linux that I am using.

I also have a GRUB 2 Recovery disk if that's of any use.  Can access the internet via another computer if required.

So what's the next stage?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #8 on: January 09, 2013, 03:15:43 pm »
OK, boot to the LiveCD .. fire up Gparted ..

Be SURE to perform these operations on sdb (Not sda which is currently the Windows drive) .. as a matter of fact, it may be worth disconnecting the Windows drive whilst you resize the partitions on the Linux drive.

and be SURE to backup anything you can't afford to loose FIRST.

IF you only want the one version of Linux (the one that fstab came from), you can delete the sdb1, and sdb6 .. resize the extended partition to be just big enough to contain sdb5 (swap) .. move sdb5 and the extended partition to the beginning of the drive .. then resize sdb7 to fill the rest of the drive.

Once you've done that .. close Gparted, open a terminal, and send the output from:
Code: [Select]
sudo fdisk -l
and
Code: [Select]
sudo blkid

BE AWARE .. this WILL break booting of both Windows and Mint .. and we'll have to reinstall GRUB later.
(so be prepared either to connect to the internet from the LiveCD to post the output, or from another PC)



Effectively, you need to KEEP sdb5 and sdb7

sdb5 stays the same size

sdb7 is resized to fill the rest of the drive.

.
« Last Edit: January 09, 2013, 03:22:08 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #9 on: January 09, 2013, 04:51:37 pm »
Will have to put this on hold for a few days as my wife is in hospital at present.

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #10 on: January 09, 2013, 05:21:05 pm »
Okey dokey .. pass on my best wishes to the Mrs, whatever the problem :)

and gimme a shout when you're ready.
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #11 on: January 15, 2013, 02:42:17 pm »
My wife is home now so I can move forward with this project.

Before going further would it be a quicker better option to formate the whole drive and reinstall mint13 64bit instead of resizing the partitions.

Another options if I formate the other partitions with the other version of Linux will mint then see them as empty drives that i could use to store files thus clearing space on my existing partition?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #12 on: January 15, 2013, 03:17:07 pm »
Both are workable options, but only you can decide which suits you best.

Formatting just the partitions, will require you to mount the new partition in fstab, but it will only be usable as "storage". ie. it will NOT be available for installing applications .. technically you cold copy your /home directory's contents to it, then mount it as your /home directory (effectively giving what's currently being used as /home back to the rest of the system , but this requires more work.

Formatting the whole thing and starting afresh gives you the option to sort any issues .. but wiil also require you to re-tweak it the way you like, and to copy off (backup) what you cannot afford to loose.
(and obviously it will get the partition scheme back in order .. not that that's really important)

Resizing partitions .. luckily Linux doesn't care if it's in a logical partition, so this is still an option.

All 3 carry risks to Windows  but not much .. really just a case of being careful not to select /dev/sda at any point.

So the choice is yours .. pick one, and we'll discuss then move ahead with it .. if you want :)
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Tramlink

  • Hero Member
  • *****
  • Posts: 678
  • Karma: 12
  • Gender: Male
  • Is the mist clearing
    • View Profile
    • Awards
Re: How to change the size of partitions?
« Reply #13 on: January 16, 2013, 02:57:29 pm »
Have decided to resize the partition and will post the required information once have finished .

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13251
  • Karma: 323
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: How to change the size of partitions?
« Reply #14 on: January 16, 2013, 03:16:32 pm »
Okey dokey .. good luck :)

I hope you've backed up anything you cannot afford to loose .. ANY partition manipulation carries a small risk of data corruption.
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal