Debian Setup
- Selected Debian Testing among Debian Stable, Debian Testing, Mint LMDE.
- Installed Debian to ext4 partition.
- After installation, found wireless didn’t work.
- dmesg | grep eth1 got nothing.
- checked NUC wireless card, it's Intel dual band wireless 7260
- then found there was no library for 7260, so apt-cache search 7260 and got firmware-iwlwifi
- apt-get install firmware-iwlwifi.
Repartition with cfdisk
Original Debian was installed to an ext4 partition(25G). I decided change to btrfs because of easy snapshot. I can do this by reinstalling everything, but I did it by transferring from my existing installation. So I kept the original ext4 root partition untouched and did repartition as the following
- Spare space 1G in HD beginning. If Grub stage1 is larger than mbr, it can take some space in the very beginning of the disk. So, we start partition after 1 g from the beginning.
- 35 G for root as /dev/sda1.
- 16 G for swap as primary partition and next to /dev/sda1
- 600 G data partition as first logical partition /dev/sda5.
Configure btrfs for system.
- My frist idea was to have two btrfs sub volumes, one as /boot, another as /, but I gave up the idea. I only need root (/), so I only have one snapshot for the whole system.
- I created a sub volume called @rootfs, using @ to distinguish btrfs sub volume from ordinary directory name. ( I didn’t follow Ubuntu btrfs to name the root btrfs as @ ).
Transfer old installation to btrfs volume
- mount my new btrfs partition as /mnt/btrfs_system
- mount —bind / /mnt/rawRoot
- Copy all files to new root
- cd /mnt/rawRoot
- tar -cvpf - . | ( cd /mnt/btrfs_system; tar -xpf - )
Configure Grub for new system
After I changed partition schema, Grub cannot boot to either my new system or old system. It entered to rescue mode, as Grub still try to find stage2 in old place, I had to tell Grub the new location of stage2
set prefix=(hd0,msdos1)/@rootfs/boot/grub # No need to escape @ in Grub. And Grub treats sub volume just like a directory. set boot=(hd0,msdos1) insmod normal # Grub will try to find module from (hd0,msdos1)/@rootfs/boot/grub/i386. Report errors if it cannot find. normal # Continue run Grub Then Grub get to the stage2,Then, I got Grub menu. Select one item and Press E. I can see the configuration for stage2 ( ../grub/grub.cfg) still had wrong references to old system, So I have to change grub root and Linux ROOT partition passed to linux kernel.
After that, boot the system.
then, Run update-grub to regenerate /boot/grub/grub.cfg, it overwrites my modification with correct references. and Grub stage2 is correctly configured.
then, run grub-install /dev/sda to replace the old Grub stage1 with the new stage1 which contains the new location for stage2. If there is no unused space in the beginning of the HD, this step returns an error message.
After all changes, reboot the system, and delete old ext4 partition.