[Troubleshoot] [ArchLinux] [Bcache] Modify Linux file system/partition scheme/DO hybrid HDD/system Rebirth Big! Hand! Postoperative (Adjust the underlying schema, no!) Heavy! Mount )

Source: Internet
Author: User
Tags rsync arch linux

Goal:

What I want to do is: Modify the file system, hard disk partitioning scheme, but do not reload the system, the entire operation is not perceived by the application layer.

Background:

My notebook is ThinkPad T450. 8G memory + 16GB SSD + 1TB HDD. Pre-assembled windows7.

In pre-installed systems 16GB SSDs seem to be used by Win7 as a function of sleep. The first thing I did after the computer got the hand, I was trying to put Linux in. My original plan was to:

1. Backup Win7. Comparison is pre-installed, also considered genuine. I copied the files from the 1TB HDD C drive. And then start the hard drive again. 1G
B DD came out. So there's a point where I can put it back and give it to someone else, when I change my new book one day.

2. Re-installed the Win7. Because the Win7 installs, will recognize the 16GB SSD, and automatically loaded things in. So you have to reload (forget how to do it) in order for the 16GB to separate out. Just load the Win7 into the front 50GB of the HDD. One more than 200 GB for D-disk.

3. Load the ArchLinux into the SSD. and booting from the SSD. This way, starting a different system, you can choose a different startup disk, without having to install a dual boot. SSD mount root directory. The/home directory is attached to the remaining 700 GB partitions of the HDD.

4. Due to the small SSD, I set the/var/below the Pacman cache to the/home. In addition, this is a file-based swap, and the file is also located under/home.

5. In this case, the basic is available. And I was smug for a long time. Feel the efficient use of SSDs.

So it's been used for 1 years, 2 months, until today. Important, the root directory is still growing to 80%, causing the system to run slowly. SSD performance becomes very slow when it's almost full (as I recall). And more importantly, swap is mechanical, and it's really obvious when it comes to swapping.

Finally, I have concluded that my plan has failed ...

New scheme:

Finally, the core content of the solution is how to use only 16GB SSD?

On the market there is a hard drive called a hybrid drive. The principle is that there is a small SSD in front of the mechanical hard drive that is used for caching. Performance is said to be the same as solid-state drives. But, Gee! Why do you want to mention this? Because under Linux, we can make homemade. Yes.

Probably these kinds of bar: Flashcache,dm-cache,lvm-cahce,bcache.

Flashcache is a Facebook-only performance, but without the kernel, the kernel needs to be compiled. Lvm-cache is Red Hat, I heard that performance is not very good? And there's no use in Archwiki. Another does not know. Bcache, into the kernel, it is! Links are not provided, please find them.

Then there is the file system problem: EXT4,XFS,BTRFS,ZFS.

In fact, I want to use btrfs, but still high experimental ah, unstable ah, or rinse. ZFS is a single-mount kernel module. Ext4 is better, but XFS is redhat7 by default. That's why I chose XFS.

Finally, use LVM. Convenience advanced why not?

Begin:

1. USB Stick BOOT.

into the U disk System, is the arch installation disk AH.

2. Mount all directories to the/mnt/root_fs/directory according to the original structure.

Yes, hang up the original system, prepare for backup, and prepare to redo.

3. Install the Rsync tool separately from the desktop and the boot USB drive.

Rsync more advanced bar, in fact, I only use its SCP function, should use some more advanced.

4. Start the desktop SSH and turn on the firewall.

The Xiu-Xiu-Xiu-Xiu-Xiu-Xiu-Xiu

5. Copy the ROOT_FS to the desktop drive using the rsync command.

Baked wow baked wow baked wow

6. Wait 6 hours ... Watch TV, sleep, eat, go out on a date ...

Wait, wait, wait.

7. Finished the exam, altogether 380GB ... Let's get started.

Baked wow baked wow baked wow

8. Partitioning

Two additional information:

https://bcache.evilpiepirate.org/

Https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt

Https://wiki.archlinux.org/index.php/LVM

About alignment: Https://wiki.archlinux.org/index.php/Partitioning#Partition_alignment

Now the tool can automatically detect if it is aligned, for example parted

8.1 Partitioning The SSD

parted Mklabel GPT

Parted Mkpart primary Linux-swap (new) 1 50%

Parted Mkpart primary 50% 100%

8.2 UEFI

Https://wiki.archlinux.org/index.php/EFI_System_Partition

EFI boot requires a FAT32 EFI partition. LVM cannot be under. Using the bootloader application that let UEFI firmware start the side here.

8.2.1 creating an EFI partition ESP (EFI System Partition)

A. Using GPT partitioned tables

B. Recommended partition size 512MiB.

C. Must be formatted as FAT32

D. Set tag ESP

8.2.2 How to modify EFI Startup items

There are two ways of using efibootmgr in the OS. This is a Linux command. But sometimes there may be some limitations or other unexplained reasons, not necessarily in OS commands. You can try it again with the EFI shell. Some motherboards have integrated the EFI shell. Some don't. Without integration, you need to install the EFI shell into ESP yourself, and then launch it in EFI loader.

  

1  +  >set1 ESP on

8.2.3 UEFI Related knowledge

Description: http://www.rodsbooks.com/efi-bootloaders/principles.html

Installation: http://www.rodsbooks.com/efi-bootloaders/installation.html

8.2-Pack Bcache-tools

Download pkg file in Aur https://aur.archlinux.org/packages/bcache-tools/

Use the makepkg name to make the package.

8.3 Doing Bcache

ESP to be done outside the Bcache.

1. Do backing device

# Make-bcache-b/dev/sda2

2. Do caching device

# make-bcache-c/DEV/SDB2

3. Registration

# bcache-super-show/dev/sdb2|grep cset.uuid|cut-f3 >/sys/block/bcache0/bcache//sys/fs/bcache

Other:

After rebooting, only udev rule. To ensure that the restart is recognized.

8.4 LVM

1. Use Lvmdiskscan to view all available devices.

2. Make the BCACHE0 into PV

# pvcreate/dev/bcache0# pvdisplay

3. Create VG

# vgcreate vg0/dev/bcache0# vgdispaly

4. Create the LV

# lvcreate-l 50G vg0-%free vg0-n lvhome
# Lvdispaly

9. Re-mount the new partition by the directory tree structure

# mount/dev/mapper/vg0-lvroot/mnt/root_fs//dev/mapper/vg0-lvhome/mnt/root_fs/home//dev/sda1/ Mnt/root_fs/boot

10. Use Rsync to reincarnate the machine back to the new file system.

 Variable and variable variable variable change variation

11. Learn about bootloader before you complete the copy

0. EFI Shell mentioned in 8.2.2

If you want to load, you can install Https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#Obtaining_UEFI_Shell from here.

1. Previous use of Systemd-boot:https://wiki.archlinux.org/index.php/systemd-boot

Systemd comes with a tool bootctl. Very simple, based on what has been set up in the previous article. You only need to use the Bootctl Install command to complete the boot loader installation. It will place two files in the/boot directory

/boot/efi/systemd/systemd-bootx64.efi     /bootefi/boot/bootx64. Efi

After you have modified the appropriate configuration file, you can use:

/boot/loader/loader.conf /boot/loader/entries/arch.conf

  

2. Get ready to try, efistub:https://wiki.archlinux.org/index.php/efistub.

This is also relatively simple.

The first trick: directly modify the UEFI page options, the boot parameters kernel location, etc., write to the UEFI option, uefi direct boot kernel:

" Arch Linux " " root=/dev/sdbz RW initrd=/initramfs-linux.img "

Remember, verify, the province's got it wrong.

# efibootmgr-v

The second trick: complete the No. 0 section. From the UEFI option into the UEFI shell. Use the command line in the UEFI Shell to start the kernel directly.

> fs0:>/vmlinuz-linux root=partuuid=3518bb68-d01e-45c9-b973-0b5d918aae96 rw initrd=/ Initramfs-linux.img

12. According to the contents of 11, after the exam open!

1. Change/etc/fstab

2. Change boot loader, delete grub2, leave Systemd-boot

3. Efibootmgr, tidy up the messy uefi menu.

13. Rebirth! :)

[Troubleshoot] [ArchLinux] [Bcache] Modify Linux file system/partition scheme/DO hybrid HDD/system Rebirth Big! Hand! Postoperative (Adjust the underlying schema, no!) Heavy! Mount )

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.