Come installare Sabayon 15.07 con filesystem BTRFS

Consigli? Suggerimenti per lo sviluppo? Idee originali? Scrivi qui!

Moderator: Moderators

Re: Come installare Sabayon 15.07 con filesystem BTRFS

Postby sabayonino » Wed Mar 23, 2016 14:05

in sostanza vorrebbe far partire il sistema solo con BTRFS

ma ,allo stato attuale, BTRFS nativamente non supporta il boot ed occorre appoggiarsi a /boot formattata in altro modo

ma qualcuno ha meso a disposizioone una patch (o hack) non ufficiale quindi non implementata per eseguire il boot
da btrfs e i subvolumi.

tutto qua.
User avatar
sabayonino
Sagely Hen
 
Posts: 2967
Joined: Sun Sep 21, 2008 1:12
Location: Italy

Re: Come installare Sabayon 15.07 con filesystem BTRFS

Postby linuxfluesterer » Thu Mar 31, 2016 11:55

Hallo guys, especially ciao Fiorello.
In your last post you said: "...pero' non ho capito bene il problema."
Si, there's no problem, the point is the benefits of btrfs.
Did you know, that you can create snapshots on a btrfs file system (and subvolumes under subvolumes)?
And those subvolumes don't really need space because they are metadata and you can work with them like
(sub) directories?
I see, you, Fiorello, are using 2 partitions with btrfs. So, you can benefit from only ONE btrfs partition then.
In last days I have followed a detailed description to install a (Debian) Linux system on btrfs.
http://blog.kourim.net/installing-debian-on-btrfs-subvolume

I finally reached my goal, not to work with any separate ext-fs partition. Though I've a DOS partitition table on a 120 GByte SSD for testing!

So, here's my way to install Sabayon on a btrfs subvolume.
Prediction: Empty (new) hard disk or ssd. First install of Sabayon. Open a root konsole or xterm as root.

Now listen: To have success, you need to be accurately! Just follow step by step.
You can use copy&paste if you have internet connection and a browser running with this site.
Anyway, I give no guarantee for your data on a btrfs, though OpenSuse's default file system is btrfs now.

However, you can post me, if there is any mistake in my description. Thank you.

If you already have an existing Sabayon Linux OS on an ext fs, then there's a way to convert ext fs to btrfs:
https://wiki.gentoo.org/wiki/Btrfs

Finally, the most benefit you will achieve if all your (earlier) mounted, separate partitions, e.g, /home, data ... will be concentrated in ONE btrfs partition, where your earlier mounted separate partitions are created as subvolumes. Then you can use all space of the whole btrfs partition
and you can make snapshots of any of your subvolumes then.

1. Boot with SL-USB-Sick (faster than DVD).
2. Install Sabayon on hard disk / SSD BUT with formatted btrfs Root (/) (you can format in SL-installer)!
e.g. for 120 GByte SSD:
/dev/sda1 Swap 16 GByte
/dev/sda2 btrfs 95,8 0GByte for /

When Sabayon is installed, no need to Reboot with installed system, keep on working with SL.

***************** Setting up btrfs subvolumes ***********************

There I mounted the Sabayon filesystem:

Code: Select all
# mkdir /mnt/rootfs/
# mount /dev/sda2 /mnt/rootfs/

Then I created the subvolume "@"
Code: Select all
# btrfs subvol create /mnt/rootfs/@

To check that the subvolume was created:
Code: Select all
# btrfs subvolume list /mnt/rootfs/
ID 264 gen 26 top level 5 path @

Then I moved all data to the newly created subvolume:
Code: Select all
# cd /mnt/rootfs
# ls -1 | egrep -v '@|home' | while read d; do mv "$d" @/; done

I created subvolume for /home in the same way:
Code: Select all
# btrfs subvol create /mnt/rootfs/@home

Then moved /home to subvolume and created the mountpoint:
Code: Select all
# mv home/* @home/
# rmdir home
# mkdir @/home

You can do the same for extra /data mountpoint also.
Code: Select all
# mkdir @/data

Then checked that all data are in the corresponding subvolumes:
Code: Select all
# ls -l /mnt/rootfs/
total 0
drwxr-xr-x 1 root root 204 Jul 16 02:26 @
drwxr-xr-x 1 root root 14 Jul 16 18:51 @home
drwxr-xr-x 1 root root 14 Jul 16 18:52 @data

and
Code: Select all
# btrfs subvolume list /mnt/rootfs/
ID 264 gen 31 top level 5 path @
ID 265 gen 30 top level 5 path @home
ID 266 gen 32 top level 5 path @data

Now you need to have an editor like midnight commander. You might install on SL system with:
Code: Select all
#equo i app-misc/mc-4.8.15

Next it was necessary to alter the /etc/fstab (in /mnt/rootfs/@/etc/fstab) and add /home and /data mountpoints configuration there. Mine looks like this:
Code: Select all
UUID=4577942d-0841-42e9-a2f3-3d04b91ff2d5  /home  btrfs   defaults,noatime,space_cache,autodefrag,compress=lzo,[email protected] 0       2
UUID=4577942d-0841-42e9-a2f3-3d04b91ff2d5  /data  btrfs   defaults,noatime,space_cache,autodefrag,compress=lzo,[email protected] 0       2

In order to be able to boot into Sabayon (from disk or ssd), it was necessary to set the "@" subvolume as default temporarily:
Code: Select all
# btrfs subvolume set-default 264 /mnt/rootfs/

!Reboot into installed Sabayon on disk now!
After reboot, if not already done, install an editor (e.g. midnight commander)!

*********** Grub2 settings *************

Now I need to change the default subvolume back to the top level volume. Otherwise the grub setup would break after the next "update-grub".
The top level subvolume has always the ID 5. First I need to mount it:
Code: Select all
# mkdir /mnt/rootfs/
# mount -o subvolid=5 /dev/sda2 /mnt/rootfs/

Now I can change the default subvolume:
Code: Select all
# btrfs subvolume set-default 5 /mnt/rootfs/

Attention: Differing to the Debian description (Sabayon has no 'update-grub command'), we need to change the file /mnt/rootfs/@/etc/default/grub.
We need to add "[email protected]" to the GRUB_CMDLINE_LINUX_DEFAULT line, so that it may look like this:
Code: Select all
GRUB_CMDLINE_LINUX_DEFFAULT="[email protected] quiet splash resume=UUID=587144de..."

Now it's possible to update grub configuration. Because of the altered /mnt/rootfs/@/etc/default/grub file the grub2-mkconfig command correctly detects that the system is using the "@" btrfs subvolume and updates the /boot/grub/grub.cfg config accordingly. That's the reason why it's not possible to continue using the "@" subvolume as default subvolume (with "set-default 264") instead of the top level volume.
The /boot/grub/grub.cfg would have configuration like "linux /@/boot/vmlinuz" but there is no other "@" subvolume in the "@" subvolume and thus the path would be incorrect. Now execute:
Code: Select all
# grub2-mkconfig -o /boot/grub/grub.cfg

Check that the /boot/grub/grub.cfg was updated:
Code: Select all
# grep '/@/' /boot/grub/grub.cfg

If you do not see any line with an "@" then repeat the command. If then still no "@" then you have a problem :( .
If you receive "@" lines, then reinstall grub with the changed configuration, otherwise it would not be able to find the necessary files on new locations:
Code: Select all
# grub2-install /dev/sda

Final touch
The only change left is altering the "/" entry in /etc/fstab to include the "[email protected]" mount option. Mine looks like this:
Code: Select all
UUID=4577942d-0841-42e9-a2f3-3d04b91ff2d5  /  btrfs   defaults,noatime,space_cache,autodefrag,compress=lzo,[email protected] 0      1

Note: I have removed 'discard' in fstab because I do trim my SSD in intervals by a cronjob.

Reboot and done.

Useful links to btrfs:
https://wiki.gentoo.org/wiki/Btrfs
https://wiki.gentoo.org/wiki/Btrfs/Native_System_Root_Guide
http://www.linux.com/learn/tutorials/767332-howto-manage-btrfs-storage-pools-subvolumes-and-snapshots-on-linux-part-1
https://www.linux.com/learn/tutorials/767683-how-to-create-and-manage-btrfs-snapshots-and-rollbacks-on-linux-part-2

-Linuxfluesterer (I love KDE...)
Take away Facebook from me and let there be real people again...
User avatar
linuxfluesterer
Old Dear Hen
 
Posts: 792
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Come installare Sabayon 15.07 con filesystem BTRFS

Postby fiorello » Mon Jun 27, 2016 10:23

Peccato non saper leggere l'inglese, perchè non capisco cosa voglia dirmi.

Noto solo oggi dopo aver fatto l'upgrade a un nuovo kernel, se faccio partire il SO direttamente scegliendo il disco dove è installato, al boot non ho lo splash, solo un trattino bianco che rimane fisso li e il systema non parte, in pratica la Core parte con il boot splash della DEV oppure con quello della Mangiaro. il suo non lo vede.

Questo è il mio fichier fstab:

Code: Select all
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>                           <mount point>  <type>  <options>  <dump>  <pass>
UUID=7b067e37-eb03-4799-8310-f0f07a2dcf58 /boot          ext4    defaults,noatime 0       2
UUID=b8f166de-980f-4ddb-ab45-e6efb5bb0dc9 /              btrfs   defaults,noatime,space_cache,autodefrag 0       1
UUID=8ef26b10-866c-47a2-b772-ad6a78228505 /home          btrfs   defaults,noatime,space_cache,autodefrag 0       2
/dev/disk/by-uuid/4F3C56457244F2DD /media ntfs-3g defaults 0 0


Quando installo il nuovo kernel:
Code: Select all
 * To avoid automounting and auto(un)installing with /boot,
 * just export the DONT_MOUNT_BOOT variable.

 * Your boot partition was detected as being mounted at /boot.
 * Files will be installed there for linux-sabayon to function correctly.
 * Preparing kernel and its modules
╠    ## Package phase: preinstall

 * Your boot partition was detected as being mounted at /boot.
 * Files will be installed there for linux-sabayon to function correctly.
╠    ## Installation du paquet: sys-kernel/linux-sabayon-4.5.7
╠    ## [Official Sabayon Linux Standard kernel image]
╠    ## Updating installed packages repository: sys-kernel/linux-sabayon-4.5.7
╠    ## Package phase: preremove

 * Your boot partition was detected as being mounted at /boot.
 * Files will be installed there for linux-sabayon to function correctly.
╠    ## Nettoyage des données d'application préalablement installées.
╠    ## Package phase: postremove
Generating grub.cfg ...
Found background: /boot/grub/default-splash.png
Found linux image: /boot/kernel-genkernel-x86_64-4.5.0-sabayon
Found initrd image: /boot/initramfs-genkernel-x86_64-4.5.0-sabayon
Found linux image: /boot/kernel-genkernel-x86_64-4.4.0-sabayon
Found initrd image: /boot/initramfs-genkernel-x86_64-4.4.0-sabayon
Found Manjaro Linux (16.06.1) on /dev/sda1
Found Windows 10 (loader) on /dev/sdc1
Found Gentoo Base System release 2.2 on /dev/sde1
done

 * You are currently booting with kernel:
 * kernel-genkernel-x86_64-4.4.0-sabayon
 *
 * Use 'eselect bzimage' in order to switch between the available ones

╠    ## Package phase: postinstall
 * Removing extents option for ext4 drives from /etc/fstab
Generating grub.cfg ...
Found background: /boot/grub/default-splash.png
Found linux image: /boot/kernel-genkernel-x86_64-4.5.0-sabayon
Found initrd image: /boot/initramfs-genkernel-x86_64-4.5.0-sabayon
Found linux image: /boot/kernel-genkernel-x86_64-4.4.0-sabayon
Found initrd image: /boot/initramfs-genkernel-x86_64-4.4.0-sabayon
Found Manjaro Linux (16.06.1) on /dev/sda1
Found Windows 10 (loader) on /dev/sdc1
Found Gentoo Base System release 2.2 on /dev/sde1
done

 * You are currently booting with kernel:
 * kernel-genkernel-x86_64-4.4.0-sabayon
 *
 * Use 'eselect bzimage' in order to switch between the available ones


 * If you are upgrading from a previous kernel, you may be interested
 * in the following document:
 *   - General upgrade guide: https://wiki.gentoo.org/wiki/Kernel/Upgrade

 * Updating module dependencies for 4.5.0-sabayon ...
depmod: WARNING: Ignored deprecated option -r                                                                                   [ ok ]
 * Please report kernel bugs at:
 * http://bugs.sabayon.org
 * The source code of this kernel is located at
 * =sys-kernel/sabayon-sources-4.5.7.
 * Sabayon Linux recommends that portage users install
 * sys-kernel/sabayon-sources-4.5.7 if you want
 * to build any packages that install kernel modules
 * (such as ati-drivers, nvidia-drivers, virtualbox, etc...).
╠    ## Nettoyage: sys-kernel/linux-sabayon-4.5.7
╠  @@ Installation terminée.
╠  @@ No configuration files to update.


Suggerimenti.
ASRock Fatal1ty Z68 Professional Gen3 *_* Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz *_* Nvidia GeForce GTX 560 TI *_* AR5416 Wireless Network Adapter {AR5008802.11(a) bgn} *_* Mémoire totale 8 Gio *_* linux4.7.0 *_* Sabayon KDE-5 *_*
Image
User avatar
fiorello
Sagely Hen
 
Posts: 1187
Joined: Mon Aug 13, 2007 14:06
Location: Bourg En Bresse - France

Re: Come installare Sabayon 15.07 con filesystem BTRFS

Postby fiorello » Thu Jul 07, 2016 12:04

:shock: UP :shock:

Nessuno ha un'idea del perchè lo splash al boot non sia presente. :|
ASRock Fatal1ty Z68 Professional Gen3 *_* Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz *_* Nvidia GeForce GTX 560 TI *_* AR5416 Wireless Network Adapter {AR5008802.11(a) bgn} *_* Mémoire totale 8 Gio *_* linux4.7.0 *_* Sabayon KDE-5 *_*
Image
User avatar
fiorello
Sagely Hen
 
Posts: 1187
Joined: Mon Aug 13, 2007 14:06
Location: Bourg En Bresse - France

Re: Come installare Sabayon 15.07 con filesystem BTRFS

Postby fiorello » Mon Jul 18, 2016 11:39

Risolto questa mattina, ero in vena di smanettare, ho reinstallato il boot grub.cfg usando l'ultima Daily, metto qui i passaggi per implementare il boot grub.cfg in caso di problemi:

Code: Select all
# mkdir -p /mnt/sabayon/boot
# mount /dev/sdb2 /mnt/sabayon
# mount /dev/sdb1 /mnt/sabayon/boot
# mount -t proc none /mnt/sabayon/proc
# mount -t sysfs sys /mnt/sabayon/sys
# mount -o bind /dev /mnt/sabayon/dev


Code: Select all
# chroot /mnt/sabayon /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"


Code: Select all
(qua sotto il chroot) #


Se non avete la partizione di /boot separata - usate questo comando:

Code: Select all
# grep -v rootfs /proc/mounts > /etc/mtab


Se avete la partizione di /boot separata - usate questo comando:

Code: Select all
# cp /proc/mounts /etc/mtab


Se avete altri S.O nel disco - usate questo comando:

Code: Select all
# grub2-install /dev/sdb2


Se avete un solo S.O nel disco - usate questo comando:

Code: Select all
# grub2-install /dev/sdb


Code: Select all
# grub-mkconfig -o /boot/grub/grub.cfg
# exit
# umount /mnt/sabayon/boot /mnt/sabayon/dev /mnt/sabayon/proc /mnt/sabayon


Voila :D

Sono rassicurato, il filesystem BTRFS non da problemi se creiamo una partizione di /boot in EXT4. :wink:

PS: sdb è il mio disco che non corrisponde per forza al vostro.:clown:
ASRock Fatal1ty Z68 Professional Gen3 *_* Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz *_* Nvidia GeForce GTX 560 TI *_* AR5416 Wireless Network Adapter {AR5008802.11(a) bgn} *_* Mémoire totale 8 Gio *_* linux4.7.0 *_* Sabayon KDE-5 *_*
Image
User avatar
fiorello
Sagely Hen
 
Posts: 1187
Joined: Mon Aug 13, 2007 14:06
Location: Bourg En Bresse - France

Previous

Return to Sabayon Linux Suggerimenti

Who is online

Users browsing this forum: No registered users and 1 guest

cron