From Fedora Project Wiki

No edit summary
No edit summary
Line 12: Line 12:
# copy your current root filesystem to /mnt: <code>cp -ax / /mnt</code>
# copy your current root filesystem to /mnt: <code>cp -ax / /mnt</code>
# edit /mnt/fstab so your root fs is mounted like: <code>LABEL=ROOTFS / ext4 defaults 1 1</code>
# edit /mnt/fstab so your root fs is mounted like: <code>LABEL=ROOTFS / ext4 defaults 1 1</code>
 
Now we have a duplicate root filesystem on /dev/BCACHE/ROOTFS. To use it we need to build a new initramfs:
 
# Open terminal
# Switch to root user: <code>su -</code>
# if needed make a bachup of /home on your root filesystem.
# comment /home out in your /etc/fstab
# unmount /home: <code>umount /home</code>
# if needed restore your bachup to the /home directory
Now your /home is in your root filesystem. Next:
# create a new filesystem on /dev/bcache0: <code>mkfs -t ext4 -L ROOTFS /dev/bcache0</code>
# mount it: <code>mount /dev/bcache0 /mnt</code>
# copy your current root filesystem to /mnt: <code>cp -ax / /mnt</code>
# edit /mnt/fstab so your root fs is mounted like: <code>LABEL=ROOTFS / ext4 defaults 1 1</code>
Now we have a duplicate root filesystem on /dev/bcache0. To use it we need to build a new initramfs:
# rename your current initramfs: <code>mv /boot/initramfs...img /boot/initramfs...img.sav</code>
# rename your current initramfs: <code>mv /boot/initramfs...img /boot/initramfs...img.sav</code>
# build a new initramfs with <code>dracut -N</code>
# build a new initramfs: <code>dracut -N</code>
Now reboot your system.
Now reboot your system.
# while in grub replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
# while in grub replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
# boot your system.
# remove any rd.lvm=0 occurrence
# boot it.
If all goes well, your system now boots fine and it's running on bcache!
If all goes well, your system now boots fine and it's running on bcache!
# Edit your /etc/grub2.cfg file..
# Edit your /etc/grub2.cfg file..
# .. duplicate the first "menuentry ... { ...}" (about 15 lines).
# .. 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
# Now change the first one and replace the root=UUID=... parameter in the "linux" line by root=LABEL=ROOTFS
# reboot again
|actions=
|actions=
# reboot your system to see if it boots OK.
# reboot your system to see if it boots OK.
Line 42: Line 29:
# All steps complete without errors
# All steps complete without errors
}}
}}
--------------------------------------------------
Now we have a stable system with /home on LVM on bcache, we can go forward and have / on bcache. Consider thought that bcache is EXPERIMENTAL!
To get / on bcache:
* create a Logical Volume: lvcreate -L 2G -n ROOTFS BCACHE
* create a filesystem: mkfs -t ext4 -L ROOTFS /dev/BCACHE/ROOTFS
* mount it: mount /dev/BCACHE/ROOTFS /mnt
* copy your current root filesystem to /mnt: cp -ax / /mnt
* 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/BCACHE/ROOTFS. To use it we need to build a new initramfs:
* rename your current initramfs: mv /boot/initramfs...img /boot/initramfs...img.sav
* create a new initramfs: dracut -N
Now reboot your system. Edit your default grub entry:
* replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
* remove any rd.lvm=0 occurrence
* boot it.
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
Now your system should boot fine.

Revision as of 17:34, 10 October 2013


Description

/ on bcache (LVM)

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

Setup

To get / on bcache:

  1. create a Logical Volume: lvcreate -L 2G -n ROOTFS BCACHE
  2. create a filesystem: mkfs -t ext4 -L ROOTFS /dev/BCACHE/ROOTFS
  3. mount it: mount /dev/BCACHE/ROOTFS /mnt
  4. copy your current root filesystem to /mnt: cp -ax / /mnt
  5. 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/BCACHE/ROOTFS. 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: dracut -N

Now reboot your system.

  1. while in grub replace the root=UUID=... parameter in the "linux" line by: root=LABEL=ROOTFS
  2. remove any rd.lvm=0 occurrence
  3. boot it.

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

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

How to test

  1. reboot your system to see if it boots OK.
  2. do some other testing if you like.

Expected Results

  1. All steps complete without errors