Saturday, December 21, 2013

PogoPlug E02 - move Debian to larger USB drive

USB drives are getting bigger and cheaper. Here are the steps I used ot move my Debian Wheezy installation from a 4GB USB drive to an 8GB USB drive.

1. partition the new drive the same way the existing one is partitioned
    * use fdisk for this step
    * this can be done on the PogoPlug or on another Linux computer
    * e.g. 3.5GB root partition (ext2) and 500MB swap partition
    * Note: this could have been done with GParted as well

2. on another Linux computer format the new USB drive partitions as ext2 and linux-swap respectively
    * I used GParted for this

3. on another Linux computer, copy the old drive to the new drive using rsync
    * plug in both drives into your Linux machine
    * mount both drives
    * as root in a terminal window:
       rsync -av /media/USBCurrent/ /media/USBNew/    
       (make sure to use the correct mount folders, careful to list the SOURCE first)
    * unmount both drives

4. check installation
   * plug new USB drive into PogoPlug
   * power on PogoPlug
   * wait for system to boot, should show up under the same name/IP as the old one

5. expand the root partition to the larger size
   * shut down PogoPlug
   * unplug new USB drive
   * plug new USB drive into Linux computer
   * with GParted move the swap partition to the end of the drive and resize the root partition as needed

6.Boot up PogoPlug
  * plug new USB drive back into the PogoPlug and power on PogoPlug


7. The UUID for the swap partition might have changed since using GParted to move/resize the swap partition.

If you issue the "top" command and under "KiB Swap" it shows 0, you have to fix this:

List the known UUIDs:
blkid -c /dev/null
Check fstab:
cat /etc/fstab

If the UUID in fstab for the line containing the swap partition does not match the UUID from the blkid output do this:
- edit fstab to change the swap partition line to the correct UUID, then save fstab
- swapon -a  to enable the swap partition

check if the change worked, issue the "top" command and check at the top under "KiB Swap".

No comments: