From Fedora Project Wiki

(Created page with "Category:Package bcache-tools test cases {{QA/Test_Case |description=/ on bcache (no LVM) Once your fresh Fedora 20 system is running, we will "move" /home to a Logical V...")
 
No edit summary
Line 3: Line 3:
|description=/ on bcache (no LVM)
|description=/ on bcache (no LVM)


Once your fresh Fedora 20 system is running, we will "move" /home to a Logical Volume (LVM) on a bcache device. Because of the flexibility that LVM provides the approach is quite different from page 1.A, for example we'll start by using sda4! Do the following steps:
Now we have a stable system with /home on bcache, we can go forward and have / on bcache. Consider though that bcache is EXPERIMENTAL!
 
To get / on bcache we'll stop using /home on bcache first:


|setup=
|setup=
# Open terminal
# Open terminal
# Switch to root user: <code>su -</code>
# Switch to root user: <code>su -</code>
# Install bcache tools: <code>yum install bcache-tools</code>
# if needed make a bachup of /home on your root filesystem.
# Make /dev/sda4 a bcache backing device: <code>make-bcache -B /dev/sda4</code>
# comment /home out in your /etc/fstab
# Make /dev/sdb1 a bcache caching device: <code>make-bcache -C /dev/sdb1</code>
# unmount /home: <code>umount /home</code>
# Note the set uuid and attach /dev/sdb1 to /dev/sda2: <code>echo <set uuid> > /sys/block/bcache0/bcache/attach</code>
# if needed restore your bachup to the /home directory
Now you have a bcache device: /dev/bcache0
Now your /home is in your root filesystem. Next:
|actions=
|actions=
# use "bcache-status -s" to see details about your bcache device.
# create a new filesystem on /dev/bcache0: <code>mkfs -t ext4 -L ROOTFS /dev/bcache0</code>
# create a Physical Volume: pvcreate /dev/bcache0
# mount it: <code>mount /dev/bcache0 /mnt</code>
# create a Volume Group: vgcreate BCACHE /dev/bcache0
# copy your current root filesystem to /mnt: <code>cp -ax / /mnt</code>
# create a Logical Volume: lvcreate -L 2G -n HOME BCACHE
# edit /mnt/fstab so your root fs is mounted like: <code>LABEL=ROOTFS / ext4 defaults 1 1</code>
# create a filesystem: mkfs -t ext4 -L HOME /dev/BCACHE/HOME
Now we have a duplicate root filesystem on /dev/bcache0. To use it we need to build a new initramfs:
This will be our new /home device. To use it first move the current /home to another mount point:
# rename your current initramfs: <code>mv /boot/initramfs...img /boot/initramfs...img.sav</code>
# replace /home entry in your /etc/fstab: LABEL=HOME /home ext4 defaults 1 2
# commands step by step:
## <code>mkdir /home.old</code>
## <code>umount /home</code>
## <code>mount /dev/sda2 /home.old</code>
## <code>mount /home</code>
## <code>cp -ax /home.old/* /home</code>
## <code>umount /home.old</code>
 
# build a new initramfs with <code>dracut -N</code>
# build a new initramfs with <code>dracut -N</code>
 
Now reboot your system.
Now you have a system with /home on LVM2 on bcache.
* while in grub replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
* boot your system.
If all goes well, your system now boots fine and it's running on bcache!
* Edit your /etc/grub2.cfg file..
* .. duplicate the first "menuentry ... { ...}" (about 15 lines).
* Now change the first one and replace the root=UUID=... parameter in the "linux" line by root=LABEL=ROOTFS
* reboot again
|results=
|results=
# All steps complete without errors
# All steps complete without errors

Revision as of 17:19, 10 October 2013


Description

/ on bcache (no LVM)

Now we have a stable system with /home on bcache, we can go forward and have / on bcache. Consider though that bcache is EXPERIMENTAL!

To get / on bcache we'll stop using /home on bcache first:

Setup

  1. Open terminal
  2. Switch to root user: su -
  3. if needed make a bachup of /home on your root filesystem.
  4. comment /home out in your /etc/fstab
  5. unmount /home: umount /home
  6. if needed restore your bachup to the /home directory

Now your /home is in your root filesystem. Next:

How to test

  1. create a new filesystem on /dev/bcache0: mkfs -t ext4 -L ROOTFS /dev/bcache0
  2. mount it: mount /dev/bcache0 /mnt
  3. copy your current root filesystem to /mnt: cp -ax / /mnt
  4. edit /mnt/fstab so your root fs is mounted like: LABEL=ROOTFS / ext4 defaults 1 1

Now we have a duplicate root filesystem on /dev/bcache0. To use it we need to build a new initramfs:

  1. rename your current initramfs: mv /boot/initramfs...img /boot/initramfs...img.sav
  2. build a new initramfs with dracut -N

Now reboot your system.

  • while in grub replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
  • boot your system.

If all goes well, your system now boots fine and it's running on bcache!

  • Edit your /etc/grub2.cfg file..
  • .. duplicate the first "menuentry ... { ...}" (about 15 lines).
  • Now change the first one and replace the root=UUID=... parameter in the "linux" line by root=LABEL=ROOTFS
  • reboot again

Expected Results

  1. All steps complete without errors
  2. reboot your system to see if it boots OK.
  3. do some other testing if you like.