You are not logged in.
Pages: 1
I don't really know if this is the right place to post this, but I want to reformat and rearrange my laptop hdd partitions to use Btrfs. If this kicks of maybe it could become a more general Btrfs thread. As I'm not in the position to backup my installation right now, I thought it would be better to plan ahead, to have a good idea of what I want to do.
Right now my filessystem looks like this
Filesystem Size Used Avail Use% Mounted on
rootfs 109G 37G 67G 36% /
dev 997M 0 997M 0% /dev
run 999M 276K 999M 1% /run
/dev/sda3 109G 37G 67G 36% /
shm 999M 39M 961M 4% /dev/shm
/dev/sda1 40G 16G 22G 43% /mnt/ubuntu_disk
dev 997M 0 997M 0% /proc/bus
I'm looking at shrinking the old ubuntu partition (I dualbooted ubuntu just for one program, but have no use for it anymore so removed it) and using it for boot. The rest would be grown into max size, and converted to btrfs using btrfs-convert as detailed here
I will then move the installed arch system into a subvolume, this will make it easer to deal with snapshots. My btrfs volume structure would look like this:
.....BTRFS Volume................................................................................................................................
.
. (0) --+-> archinstall (258) ---> bin
. | |
. | +-> dev
. | |
. | +-> etc
. | |
. | +-> and so on...
. |
. |
. |
. +-> snapshot-20120801 (259) --+-> snapshot of archinstall subvolume
.....................................................................................................................................
I would then change the default subvolume to=archinstall so I just boot into it and use it as root. If something goes wrong and I break my system, I just change the default subvolume id to use one of the snapshots, and the system will automagically log into that snapshot at boot. I will be using GPT with oldschool BIOS boot, but I haven't decided wich bootloader to use yet. Grub2 or syslinux. Any comments, hints, thoughts are welcome. I'm looking into updating the wiki when I'm finished, right now the wiki article on Installing on Btrfs root seems quite dated, atleast the syslinux bits.
Offline
If I understand correctly, are you basically "starting over"? If so, why don't you just create a new GPT partition table on your disk, create a +2M ef02 partition, then create a second partition for btrfs and then continue using the wiki as a guide? Also, I would use GRUB2, it works real well with root on BTRFS.
Offline
If I understand correctly, are you basically "starting over"? If so, why don't you just create a new GPT partition table on your disk, create a +2M ef02 partition, then create a second partition for btrfs and then continue using the wiki as a guide? Also, I would use GRUB2, it works real well with root on BTRFS.
Yes, but I think it's easier to use the btrfs functionality for converting ext4 partitions into btrfs instead of creating new partitions and moving files between them. I'm also not very keen on a fresh install, since I have installed some proprietary software that I need (mathematica, maple etc) without pacman, so a fresh install would equal more work for me.
1. Do I need an ef02 partition if I use syslinux as bootloader?
2. What is the benefit of using grub2 over syslinux?
3. Do you think I should have my boot-dir on the btrfs root instead of having it as a separate ext2 partition? What are the pros/cons of having boot as a separate partition vs having it on the btrfs root?
I'm thinking:
(ef02 partition if necessary)
/dev/sda1 ext2 /boot
/dev/sda2 btrfs /
Last edited by flako (2012-07-31 15:27:31)
Offline
Come on, backing up your system is easy:
https://wiki.archlinux.org/index.php/Fu … with_rsync
And to transfer it back to the btrfs partition:
# rsync -av source destination
Last edited by DSpider (2012-07-31 15:41:12)
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
I have a question to this btrfs-convert. I tried this command a few days ago. The result is that my 10G system took more than 30G space on the partition but I had no idea on how to release the space. Could you tell me your result when finish? Thank you.
Offline
I tried this command a few days ago. The result is that my 10G system took more than 30G space on the partition but I had no idea on how to release the space.
It backs up everything in your "/", meaning everything in /home too.
If you want to exclude "/home", add it to the list when you make the backup (tho you may need some stuff from there too, like ~/.xinitrc and other settings).
Also, if you used some kind of compression for the root partition, I think rsync transfers them uncompressed, especially if the (destination) partition was mounted without any compression attributes or anything like that.
Last edited by DSpider (2012-07-31 15:57:45)
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
Come on, backing up your system is easy:
https://wiki.archlinux.org/index.php/Fu … with_rsync
And to transfer it back to the btrfs partition:
# rsync -av source destination
I'm not were my backup disks are atm, so I'm waiting with the backup (and the btrfs experiment) until I have access to my backup media. Do you think it's easier to back up and transfer back instead of converting ext4->btrfs? As it's my laptop, ext4->btrfs seems faster than transferring files via 100mbit lan or usb 2.0. I will ofc backup my disks, I'm just questioning the efficiency of then transferring the backuped data back if it's not strictly necessary.
I have a question to this btrfs-convert. I tried this command a few days ago. The result is that my 10G system took more than 30G space on the partition but I had no idea on how to release the space. Could you tell me your result when finish? Thank you.
The conversion tool also backs up the old fs, so you have all the data stored twice.
The original filesystem image is accessible as from separate subvolume named ext2_subvol as file image. https://btrfs.wiki.kernel.org/index.php/Btrfs-convert
Last edited by flako (2012-07-31 16:46:29)
Offline
As long as you back it up to a Linux filesystem (so that permissions are preserved) you'll be fine. Don't you have any other Linux partitions with enough free space? I guess you could also create a raw .img "container" and save it on an NTFS partition... It will be slightly more complicated, and I think would be outside the scope of this topic, but here you go:
$ sudo su - #From here on out you execute everything with root privileges.
dd if=/dev/zero of=/media/Backup/backup.img bs=1024 count=10482381 #This will create a 10 GB raw image. Adjust accordingly.
modprobe loop
losetup /dev/loop5 /media/Backup/backup.img
gparted /dev/loop5 #Slap a partition table on it (eg. msdos) and a filesystem (eg. ext4).
mkdir /mnt/Virtual
mount /dev/loop5p1 /mnt/Virtual
rsync -av /* /mnt/Virtual --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs}
Last edited by DSpider (2012-07-31 16:45:49)
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
As long as you back it up to a Linux filesystem (so that permissions are preserved) you'll be fine. Don't you have any other Linux partitions with enough free space? I guess you could also create a raw .img "container" and save it on an NTFS partition... It will be slightly more complicated, and I think would be outside the scope of this topic, but here you go:
$ sudo su - #From here on out you execute everything with root privileges. dd if=/dev/zero of=/media/Backup/backup.img bs=1024 count=10482381 #This will create a 10 GB raw image. Adjust accordingly. modprobe loop losetup /dev/loop5 /media/Backup/backup.img gparted /dev/loop5 #Slap a partition table on it (eg. msdos) and a filesystem (eg. ext4). mkdir /mnt/Virtual mount /dev/loop5p1 /mnt/Virtual rsync -av /* /mnt/Virtual --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs}
I think I wan't clear enough, I want to be on the safe side and backup my install to another physical drive, not just another partition. You know, to be just a bit safer. Mount network share -> rsync. But thanks anyway for the explanation!
Anyway, backup is not an issue. I'm wondering more about bootloaders+btrfs:
1. Do I need an ef02 partition if I use syslinux as bootloader?
2. What is the benefit of using grub2 over syslinux?
3. Do you think I should have my boot-dir on the btrfs root instead of having it as a separate ext2 partition? What are the pros/cons of having boot as a separate partition vs having it on the btrfs root?
Last edited by flako (2012-07-31 16:58:12)
Offline
DSpider wrote:As long as you back it up to a Linux filesystem (so that permissions are preserved) you'll be fine. Don't you have any other Linux partitions with enough free space? I guess you could also create a raw .img "container" and save it on an NTFS partition... It will be slightly more complicated, and I think would be outside the scope of this topic, but here you go:
$ sudo su - #From here on out you execute everything with root privileges. dd if=/dev/zero of=/media/Backup/backup.img bs=1024 count=10482381 #This will create a 10 GB raw image. Adjust accordingly. modprobe loop losetup /dev/loop5 /media/Backup/backup.img gparted /dev/loop5 #Slap a partition table on it (eg. msdos) and a filesystem (eg. ext4). mkdir /mnt/Virtual mount /dev/loop5p1 /mnt/Virtual rsync -av /* /mnt/Virtual --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs}
I think I wan't clear enough, I want to be on the safe side and backup my install to another physical drive, not just another partition. You know, to be just a bit safer. Mount network share -> rsync. But thanks anyway for the explanation!
Anyway, backup is not an issue. I'm wondering more about bootloaders+btrfs:
1. Do I need an ef02 partition if I use syslinux as bootloader?
2. What is the benefit of using grub2 over syslinux?
3. Do you think I should have my boot-dir on the btrfs root instead of having it as a separate ext2 partition? What are the pros/cons of having boot as a separate partition vs having it on the btrfs root?
I would go the GRUB2 route for the simple fact that I certify the directions on the wiki will work. Backup your current data, write a new GPT partition table (gdisk /dev/sda, then 'o', then 'w').
Then create two partitions, the first ef02 (BIOS Boot Partition) the second standard linux. Then create your BTRFS filesystem on /dev/sda2 and you're good to go! Follow the wiki, it works perfectly. You do no need a separate /boot partition when using GRUB2, GRUB2 has built in support for root on BTRFS.
Offline
MrElendig said on the IRC channel that Syslinux will work from a btrfs partition as long as you don't do anything fancy with it (encryption, compression). I would probably use a separate ext2 partition.
Personally, I very much dislike GRUB2.
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
I summed up my transition to btrfs for anyone that is interested, and yes it works with syslinux
1. I shrinked the old ubuntu partition to 100mb using gparted, reformat into ext2
2. copied my /boot to the partition with rsync
# rsync -av /boot/* /mnt/ubuntu_partition
3. Set the bootflag on /dev/sda1, removed it on /dev/sda3
4. Moved /boot to /boot2, created new boot
# mv /boot /boot2
# mkdir /boot
5. Edited /etc/fstab to mount /dev/sda1 as /boot
6. Forgot to install MBR before reboot (stupid mistake!)
You should probably install syslinux first!
7. Booted new arch install media
8. Mount my archinstall
# mount /dev/sda3 /mnt
# mount /dev/sda1 /mnt/boot
chrooted into it,
# arch-chroot /mnt
# pacman -S syslinux
run syslinux install script
/usr/sbin/syslinux-install_update -iam
9. rebooted and it worked
10. Install gdisk, and convert MBR partition table into GPT, write with ‘w’
# pacman -S gdisk
# gdisk /dev/sda
11. Configure syslinux for GPT
or just run syslinux installscript again
12. boot into livemedia
13. run a check on the partition to be converted
# fsck.ext4 -f /dev/sda3
14. convert into btrfs
# btrfs-convert /dev/sda3
15. mount newly converted partition
# mkdir /mnt/btrfs
# mount /dev/sda3 /mnt/btrfs
16. arch-chroot into /mnt/btrfs
17. create subvolume for the archinstall
# btrfs subvolume create /arch
18. copy files into arch-subvolume
# rsync -av /* /arch --exclude={/arch/*,/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,/ext2_saved/*}
19.chroot into arch
# chroot /mnt/btrfs/arch /bin/bash
19.edit fstab change ext4 -> btrfs
20.mount /dev/sda1 /boot (now in chrooted arch subvolume)
21.edit syslinux.cfg
add rootflags=subvol=arch
22. edit your mkinitcpio hooks, add btrfs to the end of the hooks
23. generate new kernel
# mkinitcpio -p linux
24. reboot, you should now boot straight into arch subvolume
# reboot
25. if it works, make a snapshot of your working subvolume, mount the btrfs-root
# mount -o subvolid=0 /dev/sda3 /mnt/btrfs-root
# btrfs filesystem snapshot /mnt/btrfs-root/arch /mnt/btrfs-root/snapshot-2012-08-04
26. add an entry to your syslinux.cfg, you can enter either the subvolid of your snapshot
rootflags=subvolid=309 in my case
or rootflags=subvol=snapshot-2012-08-04
to get the id of your subvolumes run
btrfs subvolume list -p /mnt/btrfs-root
27. try rebooting and select the snapshot in your bootmenu, you should be set!
28. now you can remove the old files from your btrfs-root, boot into the arch-subvolume, mount the btrfs-root and delete all the old var, run, sys, mnt, media etc folders, be careful no to remove the system folders under your / ! You can also delete your extbackup partition by running
btrfs subvolume delete /mnt/btrfs-root/ext2_saved
I should probably have copied the install on the btrfs-root into the arch subvolume after all the config-changes had been done, doing it before that just made me do stuff twice to get the subvolumebooting to work. If you want to boot into the subvolume you choose do not use the btrfs_advanced! Anyway, now I have a nice install on btrfs, with snapshots working, I will probably go back and clean this post up and include the relevant syslinux bits in the wiki.
Offline
Pages: 1