Btrfs my new choice after ext4

After toying around with Fedora, I suddenly came across this new sweet piece of file system and was wondering what was the benefit of this and how can this be useful to me from a Linux enthusiast point of view. It’s been like appropriately a decade since I’ve given up ext3 to ext4 the latest and perhaps the preferred file system as this was default in most of the OS’s out there, wherever and whenever I was distro-hopping. So According to Google:

The maximum partition size of a btrfs file system is 16 exbibytes, and the maximum file size is also 16 exbibytes. Considering that btrfs will be able to span over multiple hard drives, it’s a good thing that it supports 16 times more drive space than ext4.

Now the point is I’m just using this for my own purpose and not running any organizational chores or say mission critical workloads. So what is this btrfs and why it’s magnetic for me, so let me tell you. According to the wiki,

As Fedora is a bleeding edge software delivering machine and I’m super duper fan of this as things hardly seems to go wrong here. I thought let’s give this a shot and let me tell you i was pretty impressed on this on Wayland running latest Gnome 3.3X shell and was blazing fast on my laptop. Btrfs is on a different level compared to Ext4. Ext4 is a “pure filesystem” while Btrfs has disk and volume management built-in. You can’t have an Ext4 filesystem that spans across multiple disks without some dirty tricks (that still do not accomplish what you want). On the other hand Btrfs can do it without a hitch because it was designed to do that. Many other features such as checksums, snapshots, raid capabilities etc are also features that set Btrfs apart from other filesystems, that is the point which i wanna put forth firmly.

So my fellow readers give Btrfs a shot and forget ext4, it has some cool system rollback and snapshot features as well. Let me know if your distro supports this and your personal experiences in the comments sections below.

You’re buttery-smooth btrfs, yay! 🙂

Is “Linux” Dead as a Platform on Desktops

Behold a giant am I, yay! I do consider “Linux” as a tertiary OS, after Windows and macOS in most terms. Even though Linux is just a kernel with all the bells and whistles put on top of that with a neat GUI and many more spanking chores to get our stuff’s done. But speaking truth is the glamour of Linux getting rust on Desktop arena specially, I think so or not, does not matter might be a personal opinion, but considering the fact that sheer 2.1% of the market share it holds is just a tiny figure in this giant universe of mankind and huh! don’t get me wrong the figures are just the opposite when we consider the fact and figures in the so foreseen “Server” regime.

What’s the point I’m considering here is the task that might be haunting in our heads but there is no straight path, I might sound little gibberish here just beating around the bush, but remember the grass seems to be greener on the other side of the fence, and here i say there is always a candy lying on the other side of the fence. Enough of rouge and vague talks, let us consider our agenda.

Fragmentation:

Yes there is and always shall be in this 2% of the desktop ruled world for geeks of all generes from sys admins to hackers and hardware enthusiasts to some newbies. There are 350 plus distros out there in the wild all of mix matched flavours and desktop environments. Some using most popular .deb installers to .rpm and yay those tar balls are there too, you shall find all those tipsy turvy extension files here in this Linux world and it is indeed fanatically adorable.

Now fellows we know once Mark Shuttleworth had announced the founder of Canonical that powers Ubuntu, the most popular ever Linux Distro out there. The thing was there shall be once update for all the products, that means one update or a security patch for phones, laptops, desktops, servers, ARM devices, IoT devices, etc. But that was and shall all the time remained a dream. I’m not blaming Canonical here it’s just my perspective they could have done a lot better with things but they just shattered while hitting the sweet spot in those golden days when Microsoft Windows Vista was struggling for the market share and then came Unity which took over Gnome 2.X and finally now Gnome 3.X with it’s own customisations of all the goodies and styled layers which adores and indeed makes Ubuntu one of the best and easiest to use Linux distributions out there. The purpose was never defeated and Ubuntu has come once again with it’s neat and flaunting flamboyant looks and has put the Gnome OS project on there thinking cap to be on.

Finally it’s all the magic of uptream and downstream projects and from where who and when implements it is what time and tice shall dictate. Gnome OS is fine and shall make some rapid strides and it’s all ok to be something original after all.

Happy hacking nerds and keep rolling the vanilla guys ! thanks for reading.

Linux Kernel 5.6 has arrived, here is what’s new

As an accolade to Mr. Torvalds and all the Linux enthusiasts out there, let us breathe a sigh of relief and greet this welcoming new version which is full of bells and whistles and without wasting any more time here we go:

WireGuard(a fast, modern, secure VPN tunnel).

A big deal for networking folks out there for the people who knows what it means and what they would be using it for, personally I don;t use VPN’s though much to be frank, rarely just for some fun sake. Wikipedia describes it as a secure VPN (Virtual Private Network) tunneling tool. It “runs as a module inside the Linux kernel” to deliver better performance (and improved privacy) than other tunnel protocols, that’s pretty much of it in a nutshell.

Support for Amazon Echo (not that interesting though but let me tell you below):

These things might amuse few hardware hackers of all genres since, this assistance from Amazon IMO is the smartest of all and support for this means you can perhaps boot Linux on top of it, sounds interesting right?. For those curious eyes, the Amazon Echo is powered by a Texas Instruments OMAP3 SoC, 256MB DRAM, and features MMC storage — not exactly top-drawer components, you see ?

USB4 support(Goodness are we in the future):

Based on Thunderbolt 3 which provides practically high data throughput and backward compatible with USB 3.2 and 2 yes you read that correct. This seems Sci-Fi as of now since such devices have not arrived in the market and it is indeed a very good move that Linux is well prepared for the upcoming future.

Better Hardware Support:

As usual with every new kernel release there comes a new better top-notch support for the upcoming hardware and yes here ARM-based SoCs, developer boards, input devices, sound cards, mice, keyboards, and so on are included. Finally, anyone running Linux 5.6 on an ASUS AMD Ryzen laptop should find that the CPU no longer overheats quickly ! Even Raspberry Pie support is enhanced further for smoother performance.

CPI idle Cooling driver:

This does not mean that heat sink would be discarded. As per Phoronix “…this driver will inject idle cycles at run-time when necessary to cool down the CPU and also reduce any static power leakage.” So IMO do not shell out a bomb on a expensive water cooling system as of now.

VirtualBox Folder Sharing:

As the name suggest, this is as simple as sharing files and folders between the guest and the host OS. Nothing great in this seems to be appeared in 5.4 but now works seamless that is what is important here.

Thanks for reading and impatient readers can get it here.(Note: Things might break or you may just mess around with your Workstation, but it’s worth a wait once it goes becomes mainline kernel).

Recover Windows 7 boot after installing Ubuntu

This seems to be self explanatory just insert the Win 7 CD and follow the below given instructions and then enter the commands one by one as mentioned below strictly without missing anyone of them.

Select your language preferences and click on Next.

Click on Repair your computer.

Select which operating system you want to restore and the click on Next. If Windows 7 is not listed here, or it is blank, then it is ok. Click on Next anyway.

Select the system recovery option you want to do:

Startup Repair

System Restore

System Image Recovery

Windows Memory Diagnostic

Command Prompt

If you managed to recover Windows 7, will have lost Grub should reinstall.

Insert the Ubuntu Desktop live-disc into the DVD drive and restart the computer.

Select Try it.

Open a terminal.

Run it:

sudo -i
fdisk -l
#Suppose fdisk informs your partition / is /dev/sda3, continue running
mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev 
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --root-directory=/mnt /dev/sda
grub-install --recheck /dev/sda
umount /mnt
reboot

That’s it.

via – arch wiki & Microsoft forums.

Install Ubuntu 18.04 desktop with RAID 1 and LVM on machine with UEFI BIOS

Query Answered in great details:-

1. Download the installer

2. Install with manual partitioning

  • During install, at the Partition disks step, select Manual.
  • If the disks contain any partitions, remove them.
    • If any logical volumes are present on your drives, select Configure the Logical Volume Manager.
      • Choose Delete logical volume until all volumes have been deleted.
      • Choose Delete volume group until all volume groups have been deleted.
    • If any RAID device is present, select Configure software RAID.
      • Choose Delete MD device until all MD devices have been deleted.
    • Delete every partition on the physical drives by choosing them and selecting Delete the partition.
  • Create physical partitions
    • On each drive, create a 512MB partition (I’ve seen others use 128MB) at the beginning of the disk, Use as: EFI System Partition.
    • On each drive, create a second partition with ‘max’ size, Use as: Physical Volume for RAID.
  • Set up RAID
    • Select Configure software RAID.
    • Select Create MD device, type RAID1, 2 active disks, 0 spare disks, and select the /dev/sda2 and /dev/sdb2 devices.
  • Set up LVM
    • Select Configure the Logical Volume Manager.
    • Create volume group vg on the /dev/md0 device.
    • Create logical volumes, e.g.
      • swap at 16G
      • root at 35G
      • tmp at 10G
      • var at 5G
      • home at 200G
  • Set up how to use the logical partitions
    • For the swap partition, select Use as: swap.
    • For the other partitions, select Use as: ext4 with the proper mount points (/, /tmp, /var, /home, respectively).
  • Select Finish partitioning and write changes to disk.
  • Allow the installation program to finish and reboot.

If you are re-installing on a drive that earlier had a RAID configuration, the RAID creation step above might fail and you never get an md device. In that case, you may have to create a Ubuntu Live USB stick, boot into that, run gparted to clear all your partition tables, before you re-start this HOWTO.

3. Inspect system

  • Check which EFI partition has been mounted. Most likely /dev/sda1. mount | grep boot
  • Check RAID status. Most likely it is synchronizing. cat /proc/mdstat

4. Clone EFI partition

The EFI bootloaded should have been installed on /dev/sda1. As that partition is not mirrored via the RAID system, we need to clone it.

sudo dd if=/dev/sda1 of=/dev/sdb1

5. Insert second drive into boot chain

This step may not be necessary, since if either drive dies, the system should boot from the (identical) EFI partitions. However, it seems prudent to ensure that we can boot from either disk.

  • Run efibootmgr -v and notice the file name for the ubuntu boot entry. On my install it was \EFI\ubuntu\shimx64.efi.
  • Run sudo efibootmgr -c -d /dev/sdb -p 1 -L "ubuntu2" -l \EFI\ubuntu\shimx64.efi. Depending on your shell, you might have to escape the backslashes.
  • Verify with efibootmgr -v that you have the same file name for the ubuntu and ubuntu2 boot items and that they are the first two in the boot order.
  • Now the system should boot even if either of the drives fail!

7. Wait

If you want to try to physically remove or disable any drive to test your installation, you must first wait until the RAID synchronization has finished! Monitor the progress with cat /proc/mdstat However, you may perform step 8 below while waiting.

8. Remove BTRFS

If one drive fails (after the synchronization is complete), the system will still boot. However, the boot sequence will spend a lot of time looking for btrfs file systems. To remove that unnecessary wait, run

sudo apt-get purge btrfs-progs

This should remove btrfs-progs, btrfs-tools and ubuntu-server. The last package is just a meta package, so if no more packages are listed for removal, you should be ok.

9. Install the desktop version

Run sudo apt install ubuntu-desktop to install the desktop version. After that, the synchronization is probably done and your system is configured and should survive a disk failure!

10. Update EFI partition after grub-efi-amd64 update

When the package grub-efi-amd64 is updated, the files on the EFI partition (mounted at /boot/efi) may change. In that case, the update must be cloned manually to the mirror partition. Luckily, you should get a warning from the update manager that grub-efi-amd64 is about to be updated, so you don’t have to check after every update.

10.1 Find out clone source, quick way

If you haven’t rebooted after the update, use

mount | grep boot

to find out what EFI partition is mounted. That partition, typically /dev/sdb1, should be used as the clone source.

10.2 Find out clone source, paranoid way

Create mount points and mount both partitions:

sudo mkdir /tmp/sda1 /tmp/sdb1
sudo mount /dev/sda1 /tmp/sda1
sudo mount /dev/sdb1 /tmp/sdb1

Find timestamp of newest file in each tree

sudo find /tmp/sda1 -type f -printf '%T+ %p\n' | sort | tail -n 1 > /tmp/newest.sda1
sudo find /tmp/sdb1 -type f -printf '%T+ %p\n' | sort | tail -n 1 > /tmp/newest.sdb1

Compare timestamps

cat /tmp/newest.sd* | sort | tail -n 1 | perl -ne 'm,/tmp/(sd[ab]1)/, && print "/dev/$1 is newest.\n"'

Should print /dev/sdb1 is newest (most likely) or /dev/sda1 is newest. That partition should be used as the clone source.

Unmount the partitions before the cloning to avoid cache/partition inconsistency.

sudo umount /tmp/sda1 /tmp/sdb1

10.3 Clone

If /dev/sdb1 was the clone source:

sudo dd if=/dev/sdb1 of=/dev/sda1

If /dev/sda1 was the clone source:

sudo dd if=/dev/sda1 of=/dev/sdb1

Done!

/*_*\

Success rate upto 90% as per Niclas Börlin’s answer @askubuntu.

Ubuntu Desktop 18.04 LTS not able to detect Samsung PCIe NVME SSD

Well after a lot of google search, I’ve come across this post. The issue was at the BIOS level, in case of Dell desktops and laptops

  • one has to set the SATA mode to AHCI rather than the default Raid On. If you don’t follow the above post
  • your machine won’t boot Windows 10 as the AHCI driver is by default not installed. That’s why one need to go into the safemode first then make the changes in BIOS and then disable the safemode. Being in the safemode
  • it installs the AHCI drivers via which O/S can talk to the drives. After this I booted via the live USB and i can see the Samsung PCIe NVME SSD being visible from the gparted.

Connecting Bluetooth Peripherals via terminal in Linux

Let’s say you’re device has a Bluetooth installed and wanna play around it with the terminal rather than a boring GUI which not so cool people do, you know what I’m saying geeks here like to play with the terminal right 🙂

Before start, make sure your device has a Bluetooth interface or else get a cheap USB Bluetooth dongle.

$ sudo apt install bluetooth

This will install bluetoothctl and bluetoothd.
Start the bluetooth service.

$ sudo service bluetooth start
$ sudo bluetoothctl
[bluetooth] agent on
[bluetooth] default-agent
[bluetooth] scan on
[bluetooth] devices
[bluetooth] pair <bluetooth_mac_address>

If you’re pairing a Bluetooth keyboard, it will show a key to pair the keyboard. Type that key using the Bluetooth keyboard and press enter key to get paired. Finally,

[bluetooth] connect <bluetooth_mac_address>