3

My NAS runs Ubuntu Server 12.04, it runs this from an 8gb USB disk which is getting quite full so I have transferred that to a 32gb key using

dd if=/dev/sdc of=/dev/sdb bs=512

Now, this is great, it now boots as it should - problem is that the new drive is reporting as being the same size

/dev/sdb1       6.4G  5.3G  837M  87% /media/f8772a74-ab0a-450c-9453-0ea91422051f

so i try

$ sudo resize2fs /dev/sdb1

and get

The filesystem is already 1694208 blocks long.  Nothing to do!

Soooo.. i try

sudo fdisk -l

and get

   Device Boot      Start         End      Blocks   Id  System
   /dev/sdb1   *        2048    13555711     6776832   83  Linux
   /dev/sdb2        13557758    15632383     1037313    5  Extended
   /dev/sdb5        13557760    15632383     1037312   82  Linux swap / Solaris

Now I'm out of ideas - do i need to 'merge' sdb2 and sdb5 ? what should i do to use the full space.

Thx in advance

2 Answers 2

2

do i need to 'merge' sdb2 and sdb5 ? what should i do to use the full space.

Yes, that's it, essentially. To use the available space you must:

  • expand the partition
  • then expand the file system

You used resize2fs correctly, but it cannot use more space than the partition provides, so the partition must be expanded first. You can do that with fdisk or cfdisk, or use some frontend like Gparted (graphical) or GNU Parted (console).

Note that this case is a bit special because you have one primary partition (sdb1) and one extended partition (sdb2) containing a logical partition (sdb5). You'll have to delete sdb2 (thus deleting sdb5 that lies inside), then expand sdb1.

Note: I hope I don't need to mention that before doing this, you should check that the backups which you certainly have are up-to-date and complete...

Also, check what the other partitions contain before deleting them.

2
  • 2
    DO NOT MERGE sdb2 and sdb5 - sdb2 is a "Virtual" partition to allow more then 4 primary partitions.
    – davidgo
    Jan 7, 2014 at 17:11
  • @davidgo: Thanks for the hint. I incorporated it into my answer.
    – sleske
    Jan 7, 2014 at 20:33
1

Simply copying the entire disk (or stick) from a lower capacity to a higher capacity does not take advantage of the larger size. You'll need to first resize the partition, then resize the file system. I'm a fan of Gparted http://gparted.org/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .