Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jun 052011

Create a swap partition using LVM


To create a swap partition using LVM, you just need a few commands!

1. Create a 1G swap partition

# lvcreate -L 1G -n /dev/vg0/swap0

2. Set up a Linux swap partition

# mkswap /dev/vg0/swap0

3. Enable it

# swapon -s /dev/vg0/swap0

You might also want to put the settings in the /etc/fstab, so it will be mounted automatically when your system boot next time.

# sudo vi /etc/fstab

/dev/vg0/swap0       none            swap     sw              0       0

Save and restart your system to test if it is working when system reboot.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>