Upgrading/expanding hardware questions

Asked by GregL on 2010-02-16

Good evening. I've installed Ubuntu 9.10 on a laptop with 512 MB of RAM and a 40 GB hard drive. I have purchased RAM to max out this system to 2 GB and I have a spare 80 GB hard drive on hand I'd like to put to use. I have two questions:

1. In the past, it has been my experience that the swap partition was based on the amount of RAM during the installation. If I increase it from 512 MB to 2 GB, should I consider using a utility to increase the swap partition size from its existing 1.5 GB?

2. I'd like to clone the existing installation using Clonezilla (or whatever you all suggest) to the spare 80 GB hard drive. Can I expand the partitions to take all the hard disk space of the new hard disk, or will it just make a 40 GB partition on the new drive?

My questions are necessary since I really like how it is set up and running right now. The WiFi card took some work and I'd like to avoid having to do it again.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
GregL
Solved:
2010-02-20
Last query:
2010-02-20
Last reply:
2010-02-20

What I tend to do when going to a larger hard drive is to just use dd

Run 'sudo fdisk -l'

You will see lines like this:
Disk /dev/sda: 250.1 GB, 250059350016 bytes

We'll assume /dev/sda is your 40 GB drive
We'll assume /dev/sdb is your 80 GB drive

Run: 'sudo fdisk /dev/sdb'
d <enter> 4
d <enter> 3
d <enter> 2
d <enter> 1
w <enter>
This will delete all partitions on the drive and write the changes. This step isn't really needed but is very helpful.

Run 'sudo dd if=/dev/sda of=/dev/sdb'
This will make an exact copy of your 40 GB drive on the newer 80 GB drive.

Now you can use gparted to grow the partitions on the drive. As far as swap goes.... The only reason it's ever been based on RAM is for hibernate/suspend. If you don't use hibernate/suspen there's no need to grow the swap space. Also, if don't have problems without growing it then it's just wasted time.

GregL (greg-lumpkin) said : #2

OK, let me hive that a shot Michael. This is a laptop so hibernate/suspend is something I'd like to use. I have an IDE to USB cable so I'll sling the new drive off one of the laptop's USB ports and try the commands you outlined. I'll let you know what happens.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sounds great; best of luck to you.

On Wed, 17 Feb 2010 18:05:53 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> OK, let me hive that a shot Michael. This is a laptop so
> hibernate/suspend is something I'd like to use. I have an IDE to USB
> cable so I'll sling the new drive off one of the laptop's USB ports and
> try the commands you outlined. I'll let you know what happens.
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt8NCUACgkQ3y7Nst6YLGU02wCeKvNO3tTAmSJC3ybZxvTFrys6
2koAoKQyfAvY19LbOdCnSTnmZtiSqwcF
=7arf
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #4

OK, that worked like a charm. After installing the new hard drive, I was able to use GParted on the Ubuntu 9.10 Live CD to grow the swap partition, but I can't seem to grow the /dev/sda1 (ext4) partition. Could it be because it is separated from the unallocated space by the /dev/sda2 (extended) partition? Do I need to move the extended partition? If so, how?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can't grow a partition beyond the limits of other partitions.

Works:
| 1 | 2 | 4 | 5 | 6 |
Doesn't work:
| 1 | 2 | 4 | 2 | 5 |

That's pretty much exactly what you said I think..

You can use gparted to move the last partition to the end of the free
space and grow the one in the middle.

I'm glad it worked out for you so well. That was the hardest part. :D -
Now it's just time consuming to move large blocks of data and grow them.

On Thu, 18 Feb 2010 04:25:26 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> OK, that worked like a charm. After installing the new hard drive, I
> was able to use GParted on the Ubuntu 9.10 Live CD to grow the swap
> partition, but I can't seem to grow the /dev/sda1 (ext4) partition.
> Could it be because it is separated from the unallocated space by the
> /dev/sda2 (extended) partition? Do I need to move the extended
> partition? If so, how?
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt8w/kACgkQ3y7Nst6YLGXv6wCgrLEcfcuE1vxzYii52FqhXxIT
H2wAnjKWLlzA9BN4ocUwiNvPpKS/yiyR
=cNtB
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #6

Yeah, I just did some research this morning and confirmed that I can't grow the Linux partition into the unallocated space until the swap partition gets out of the way. One suggestion was to delete the swap partition and then recreate it at the end of the free space so that the Linux partition will have room to grow. I'm a little concerned that I'll know how to recreate it at the end of the free space after deleting it. It harkens me back to the days of DOS when I first used the FDISK command. I was so paranoid... :-)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I would use gparted to do all of this. There's little point in using
fdisk if you're not comfortable with it. If you delete your swap,
that's not such a big deal. You could even run without it entirely. I
have some systems where I do run without swap for various reasons.

In gparted:
Delete swap
Expand partition (say 2GB before end of disk)
Create new partition
  of type swap-space
Apply changes.

On Thu, 18 Feb 2010 13:10:19 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> Yeah, I just did some research this morning and confirmed that I can't
> grow the Linux partition into the unallocated space until the swap
> partition gets out of the way. One suggestion was to delete the swap
> partition and then recreate it at the end of the free space so that the
> Linux partition will have room to grow. I'm a little concerned that
> I'll know how to recreate it at the end of the free space after deleting
> it. It harkens me back to the days of DOS when I first used the FDISK
> command. I was so paranoid... :-)
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt9P6QACgkQ3y7Nst6YLGUjIQCgjamCeKnPHS8bO6whTSUkVOUc
riwAoIGM40eessibkw/+BTgziFJKEsdS
=FlTs
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #8

Totally agree about GParted. It's a nice tool. Your instructions follow everything I've read today so I'll give it a shot when I get home. Hopefully, later on today, I'll mark this matter as solved. :-)

GregL (greg-lumpkin) said : #9

OK, all done. I downloaded the GParted Live CD and did the work there. I didn't have swap on, but I've since rectified that.

Now, the only issue I have is a couple of error messages that show up during bootup and shutdown. They don't last on the screen very long, but basically, an fschk (sp?) message in the upper left hand appears and just below the Ubuntu logo, a message states that mount points are different than what fstab thinks it should be. Forgive my paraphrasing if it sounds stupid. Anyway, this is what /etc/fstab has:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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 defaults 0 0
# / was on /dev/sda1 during installation
UUID=f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=d2597056-320a-4f46-bf81-6de3b44af84d none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

I guess this is a byproduct of the new drive/partitioning?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your swap will have changed entirely. You'll want two terminals open
for this.

First ternimal:
ls -l /dev/disk/by-uuid/

Second terminal:
sudo vim /etc/fstab
  - You can use gedit or nano if you prefer

What you have:
> # / was on /dev/sda1 during installation
> UUID=f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 / ext4 errors=remount-ro 0 1
> # swap was on /dev/sda5 during installation
> UUID=d2597056-320a-4f46-bf81-6de3b44af84d none swap sw 0 0

Broken into two parts:
> # swap was on /dev/sda5 during installation
> UUID=d2597056-320a-4f46-bf81-6de3b44af84d none swap sw 0 0

The comment "#" line you see /dev/sda5. This is what your swap
partition is. In your ls output you will see something like this.
lrwxrwxrwx 1 root root 10 2010-02-18 20:01 9c41ab18-64d6-4ffe-9a27-32fea11b0209 -> ../../sda5
^mine - This is the part of that line that matters
"9c41ab18-64d6-4ffe-9a27-32fea11b0209"

That string of numbers is your UUID. Make sure the UUID is the same as
what is in /etc/fstab.

If you save this file, then reboot - the error should go away.

If you want, you can give me the contents of /etc/fstab and the ls
output and I can put it together for you. However, you seem perfectly
competent and able to figure this out.

Considering you made it this far - I'd say you'll get this part in an
instant. Funny enough, I decided I need to do this to my system. This
is how my stuff changed:

From:
/dev/sda: | /boot (100MB) | / (13GB) | /home 110GB |[ swap (2GB) | /vm (110GB) ]|
To:
/dev/sda: | WinXP (30GB) | / (13GB) | /home 80GB |[ swap (2GB) | /vm (107GB) | /media/shared (3GB) ]|

GParted was a godsend in this alteration. I have 15min left before I
start burning and installing WinXP. :'( Overall it's not too hard. Just
learn the process then it's a simple thing to do over and over. Always
time consuming though.

On Fri, 19 Feb 2010 03:52:09 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> OK, all done. I downloaded the GParted Live CD and did the work there.
> I didn't have swap on, but I've since rectified that.
>
> Now, the only issue I have is a couple of error messages that show up
> during bootup and shutdown. They don't last on the screen very long,
> but basically, an fschk (sp?) message in the upper left hand appears and
> just below the Ubuntu logo, a message states that mount points are
> different than what fstab thinks it should be. Forgive my paraphrasing
> if it sounds stupid. Anyway, this is what /etc/fstab has:
>
> # /etc/fstab: static file system information.
> #
> # Use 'blkid -o value -s UUID' 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 defaults 0 0
> # / was on /dev/sda1 during installation
> UUID=f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 / ext4 errors=remount-ro 0 1
> # swap was on /dev/sda5 during installation
> UUID=d2597056-320a-4f46-bf81-6de3b44af84d none swap sw 0 0
> /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
>
> I guess this is a byproduct of the new drive/partitioning?
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt+DpMACgkQ3y7Nst6YLGUNJgCfeTTp+A6e/esCH9K6nqimpskN
eY8AoJXL97l+Q7tNeSnV3zwhb9cqiOMd
=GQ/L
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #11

I'm at work right now (I'm a computer support tech for a local school district) but will do this when I get home. Michael, you have been a great help through all this. Very informative and you give great instructions. Thank you!

I still consider myselff a Linux newbie even though I've used every distro out there almost since RedHat 6 or so. Problem is, I have never used them that long. I end up (for some unknown reason) reverting back to WinXP. I like Ubuntu and have two machines that I am making a concerted effort to use exclusively with Ubuntu. I want to learn Linux beyond the GUI. I'm giving my kids a head start by putting Qimo on their computers. Never too young to learn! :-)

Again, thanks for all your time and assistance. I'll let you know what happens this evening when I edit the settings.

GregL (greg-lumpkin) said : #12

OK, 99.9% there. :-) One error has gone, but I still get an error in the upper left hand side of the screen during bootup (it goes away fast, but it says something about swap) and I think I know what it is. I don't think the swap partition is activating automatically. In GParted, the swap partition gives me the Swapon option under the Partition pulldown. If I look at the partition information, it's status is Not active.

fstab shows this now:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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 defaults 0 0
# / was on /dev/sda1 during installation
UUID=f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
21dc15bb-b926-4301-bc50-493457fb4454 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

The output of ls -l /dev/disk/by-uuid/ is:

glumpkin@glumpkin-laptop:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2010-02-19 19:16 21dc15bb-b926-4301-bc50-493457fb4454 -> ../../sda5
lrwxrwxrwx 1 root root 10 2010-02-19 19:15 f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 -> ../../sda1
glumpkin@glumpkin-laptop:~$

Any ideas?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Change this:
21dc15bb-b926-4301-bc50-493457fb4454 none swap sw 0 0

To this:
UUID=21dc15bb-b926-4301-bc50-493457fb4454 none swap sw 0 0

It's just missing the UUID=

On Sat, 20 Feb 2010 00:29:36 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> OK, 99.9% there. :-) One error has gone, but I still get an error in
> the upper left hand side of the screen during bootup (it goes away fast,
> but it says something about swap) and I think I know what it is. I
> don't think the swap partition is activating automatically. In GParted,
> the swap partition gives me the Swapon option under the Partition
> pulldown. If I look at the partition information, it's status is Not
> active.
>
> fstab shows this now:
>
> # /etc/fstab: static file system information.
> #
> # Use 'blkid -o value -s UUID' 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 defaults 0 0
> # / was on /dev/sda1 during installation
> UUID=f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 / ext4 errors=remount-ro 0 1
> # swap was on /dev/sda5 during installation
> 21dc15bb-b926-4301-bc50-493457fb4454 none swap sw 0 0
> /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
>
> The output of ls -l /dev/disk/by-uuid/ is:
>
> glumpkin@glumpkin-laptop:~$ ls -l /dev/disk/by-uuid/
> total 0
> lrwxrwxrwx 1 root root 10 2010-02-19 19:16 21dc15bb-b926-4301-bc50-493457fb4454 -> ../../sda5
> lrwxrwxrwx 1 root root 10 2010-02-19 19:15 f4bfd32e-ae43-466e-a67a-f33b6d1b51c2 -> ../../sda1
> glumpkin@glumpkin-laptop:~$
>
> Any ideas?
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt/LmwACgkQ3y7Nst6YLGXK9gCeODT2Ownv78HdvYx6AiabnqP7
yvMAn3oJYKz21+8fwiXmfPe+wN9/By1k
=hh+U
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #14

Yep. I just caught that and fixed it after I posted my previous message.

I'm still getting some message just after the Ubuntu logo goes and the desktop appears. Something about fschk and clean volume? Is it running some kind of disk check? I don't remember seeing that before I did the hard drive upgrade. Is it something to do with "errors=remount-ro 0 1" in fstab?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

fsck normally runs on every boot. It normally does a very quick check
on the auto mounted partitions. By default every 30 mounts (maybe 34) it
will run a full check on the partition.

It's not an error, just normal. You can check by running the 'free'
command which will show you available swap.

Congrats!

On Sat, 20 Feb 2010 00:55:59 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> GregL posted a new comment:
> Yep. I just caught that and fixed it after I posted my previous
> message.
>
> I'm still getting some message just after the Ubuntu logo goes and the
> desktop appears. Something about fschk and clean volume? Is it running
> some kind of disk check? I don't remember seeing that before I did the
> hard drive upgrade. Is it something to do with "errors=remount-ro 0 1"
> in fstab?
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt/OX8ACgkQ3y7Nst6YLGU0uQCePKOPgXnZuAqeRDfkvXEtDqzZ
9UkAn2Ofee2KLUeBcWN1qWWs41DbQ8zp
=zc2X
-----END PGP SIGNATURE-----

GregL (greg-lumpkin) said : #16

Thank you again Michael for all your help and for patiently educating me on Linux partitions. I couldn't have done it without your help. I'm going to mark this as solved and I do hope you have a great weekend! Take care, Greg.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not this weekend, maybe the next one. :P

I enjoy teaching those willing to learn and I'm glad all is well for
you. Congrats. Also, I'm on IRC quite often. Feel free to meet me there
if you ever need anything else.

On Sat, 20 Feb 2010 01:42:44 -0000
GregL <email address hidden> wrote:

> Question #101237 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/101237
>
> Status: Answered => Solved
>
> GregL confirmed that the question is solved:
> Thank you again Michael for all your help and for patiently educating me
> on Linux partitions. I couldn't have done it without your help. I'm
> going to mark this as solved and I do hope you have a great weekend!
> Take care, Greg.
>

- --
Michael Lustfield
Kalliki Software

Network and Systems Administrator
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt/PwAACgkQ3y7Nst6YLGWIjgCeOwGx9bA7ELICvMC9/6bwDfr0
2h8An1M57GXHUTEqxh0f+k3FWZRpGoCW
=6DJt
-----END PGP SIGNATURE-----