If you're adding a partition with an existing file structure that you don't want to delete, skip steps 1 and 2 as the partitions will already be created. If you're mounting a partition to replace your encrypted home directory, then see the Sources tab for the Help Ubuntu link where you can find a section on how to re-encrypt your home directory files.
- Ex:
sudo fdisk /dev/sdb
(creates sdb1)
- Ex:
sudo mkfs-ext4 /dev/sbd1
- Go with the defaults (just hit enter for the defaults) unless you know what your doing.
sudo blkid
this lists all the UUIDs of all paritions- Look for the parition you just made (or added) and copy it's UUID (or leave this terminal window up)
sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)
this creates the backup of your fstab file with todays date- You do not want to f-up this file
gksu gedit /etc/fstab
this prompts the gedit text editor to open the fstab file, but you can choose whichever editor you like- Add a new line for your parition (seen below)
- You'll replace the ?s with the UUID you found with
blkid
. You'll have to specify a directory for mounting. - If you are using this partition to replace an existing directory, assign a temporary directory as the mounting location (which you'll make in the next step)
UUID=???????? /path/to/directory/for/mounting ext4 defaults 0 2
- Ex:
[sudo] mkdir /media/home
mount -a
[sudo] rsync -av <source> <destination>
- Ex:
sudo rsync -av /home/. /media/home/.
- Specifying the
.
is important, otherwise you'll copy a new directoryhome
inside/media/home/
(i.e. you'll make/media/home/home
)
- Specifying the
After you have the partition set up, you can replace the new partition's mounting location with the existing directory location
- Ex:
UUID=???????? /home ext4 defaults 0 2
Important to be safe, you should back up the existing directory before remounting the new partition to overwrite it.
- Ex: [sudo] mv /home /old-home && [sudo] mkdir /home
mount -a
sudo diff -r /home /old-home
- You can optionally add the
-x ".gvfs/*"
to avoid warnings when diffing files in your home directory.
rm -rf /old-home
And you're done!