分类 伪技术 下的文章

1.查看分割区的编号
parted里面执行print

(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  4295MB  4294MB  primary   ext4            boot
 2      4296MB  9999MB  5703MB  extended
 5      4296MB  5368MB  1072MB  logical   linux-swap(v1)

2.删除多余的分割区

(parted) rm 2                                                             
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore                                                     
#再次查看分割区
(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  4295MB  4294MB  primary  ext4         boot

3.调整磁盘大小

(parted) resizepart                                                       
Partition number? 1                                                       
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
End?  [4295MB]? 100%                                                      
Error: Error informing the kernel about modifications to partition /dev/sda1 -- 设备或资源忙.  This means Linux won't know about any changes you made to /dev/sda1 until you
reboot -- so you shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel? Ignore                                                     
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore

4.查看磁盘信息

root@:~# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe0afa735

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 20971519 20969472  10G 83 Linux
#/dev/sda1 已经由5G变成10G了

5.重启服务器
reboot
6.resize2fs /dev/sda1

root@:~# resize2fs /dev/sda1
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sda1 is now 2621184 (4k) blocks long.

7.df -h

root@:~# df -h
文件系统        容量  已用  可用 已用% 挂载点
udev            480M     0  480M    0% /dev
tmpfs            99M  2.9M   96M    3% /run
/dev/sda1       9.8G  1.4G  8.0G   15% /
tmpfs           494M     0  494M    0% /dev/shm
tmpfs           5.0M     0  5.0M    0% /run/lock
tmpfs           494M     0  494M    0% /sys/fs/cgroup
tmpfs            99M     0   99M    0% /run/user/0

有时候用一键脚本安装bbrplus需要手动调整内核的启动顺序才能正常使用,以下记录下过程
1.grep目前的内核
cat /boot/grub/grub.cfg |grep "menuentry "
得到的结果如下所示

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4dd00551-6a99-455a-a7c8-bd1e42d4ecdd' {
    menuentry 'Debian GNU/Linux, with Linux 4.19.0-11-cloud-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-11-cloud-amd64-advanced-4dd00551-6a99-455a-a7c8-bd1e42d4ecdd' {
    menuentry 'Debian GNU/Linux, with Linux 4.19.0-11-cloud-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-11-cloud-amd64-recovery-4dd00551-6a99-455a-a7c8-bd1e42d4ecdd' {
    menuentry 'Debian GNU/Linux, with Linux 4.14.182-bbrplus' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.14.182-bbrplus-advanced-4dd00551-6a99-455a-a7c8-bd1e42d4ecdd' {
    menuentry 'Debian GNU/Linux, with Linux 4.14.182-bbrplus (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.14.182-bbrplus-recovery-4dd00551-6a99-455a-a7c8-bd1e42d4ecdd' {

2.修改grub

vi /etc/default/grub
将 GRUB_DEFAULT=0 修改为
GRUB_DEFAULT="Advanced options for Debian GNU/Linux>Debian GNU/Linux, with Linux 4.14.182-bbrplus"
update-grub

参考:https://blog.csdn.net/fcymk2/article/details/86551823

联系tg:@fat00119
仅限个人用户 大流量、机场勿扰
1.广州移动 10/端口
2.成都 电信入 自选出 7/端口
3.河南移动 5/端口
4.宿迁移动 5/端口
5.枣庄联通 6/端口
6.镇江联通 5/端口

执行lsblk命令查看能否正常识别mmcblk1分区,若不能识别则无法刷入emmc

install.sh文件代码如下

#!/bin/sh
 
echo "Start script create MBR and filesystem"
 
DEV_EMMC=/dev/mmcblk1
 
echo "Start backup u-boot default"
 
dd if="${DEV_EMMC}" of=/boot/u-boot-default.img bs=1M count=4
 
echo "Start create MBR and partittion"
 
parted -s "${DEV_EMMC}" mklabel msdos
# `bootloader` / `reserved` occupies [0, 100M).
# Sector size is 512B.
parted -s "${DEV_EMMC}" unit s mkpart primary fat32 204800 466943  # [100M, 228M)
parted -s "${DEV_EMMC}" unit s mkpart primary ext4 466944 100%     # [228M, ...]
 
echo "Start restore u-boot"
 
dd if=/boot/u-boot-default.img of="${DEV_EMMC}" conv=fsync bs=1 count=442
dd if=/boot/u-boot-default.img of="${DEV_EMMC}" conv=fsync bs=512 skip=1 seek=1
 
sync
 
echo "Done"
 
echo "Start copy system for eMMC."
 
mkdir -p /ddbr
chmod 777 /ddbr
 
PART_BOOT="/dev/mmcblk1p1"
PART_ROOT="/dev/mmcblk1p2"
DIR_INSTALL="/ddbr/install"
 
if [ -d $DIR_INSTALL ] ; then
    rm -rf $DIR_INSTALL
fi
mkdir -p $DIR_INSTALL
 
if grep -q $PART_BOOT /proc/mounts ; then
    echo "Unmounting BOOT partiton."
    umount -f $PART_BOOT
fi
echo -n "Formatting BOOT partition..."
mkfs.vfat -n "BOOT_EMMC" $PART_BOOT
echo "done."
 
mount -o rw $PART_BOOT $DIR_INSTALL
 
echo -n "Cppying BOOT..."
cp -r /boot/* $DIR_INSTALL && sync
echo "done."
 
echo -n "Edit init config..."
sed -e "s/ROOTFS/ROOT_EMMC/g" \
 -i "$DIR_INSTALL/uEnv.ini"
echo "done."
 
rm $DIR_INSTALL/s9*
rm $DIR_INSTALL/aml*
rm -rf $DIR_INSTALL/n1*
 
umount $DIR_INSTALL
 
if grep -q $PART_ROOT /proc/mounts ; then
    echo "Unmounting ROOT partiton."
    umount -f $PART_ROOT
fi
 
if [ -e /boot/n1-logo.img ] ; then
# The logo should be no greater than 8M. (It's less than 5M in my case.)
echo "Installing Ubuntu logo..."
dd if=/boot/n1-logo.img of=/dev/mmcblk1 bs=1M seek=644
echo "done."
fi
 
echo "Formatting ROOT partition..."
# 0x27400000 ~ +0x800000 is used by `/dev/env`. Mark them as bad blocks
# so that they won't be used by Linux. (It seems that they're overwritten
# each time system boots if invalid.)
#
# As `ROOT_EMMC` starts from 228M, offset of `/dev/env` in this partition
# is 400M.
#
# Here we generates a sequence of block number in range [400M, 408M), with
# block size = 4K, and pass them as bad blocks to `mke2fs`.
#
# Given that we're using 4K blocks, the mapped block number will be [102400,
# 104448), or [102400, 104447].
#
# `/dev/logo` is in range [644M, 772M) (of the whole `/dev/mmcblk1`, not this
# partition. Minus 228M yourself.). Mark them as bad blocks if you want to
# preserve or replace the boot logo.
#
# All other partitions (`recovery`, `rsv`, `tee`, `crypt`, `misc`, `boot`,
# `system`, `data` is already overwritten by the original script, as it
# places the first partition at 700M.)
echo "Marked blocks used by /dev/env as bad to protected them from being overwritten."
seq 102400 104447 > /tmp/reservedblks
if [ -e /boot/n1-logo.img ] ; then
echo "Marked blocks used by /dev/logo as bad."
seq 106496 108543 >> /tmp/reservedblks  # Only first 8M of `/dev/logo` is reserved.
fi
mke2fs -F -q -t ext4 -L ROOT_EMMC -m 0 $PART_ROOT -b 4096 -l /tmp/reservedblks
e2fsck -n $PART_ROOT
echo "done."
 
echo "Copying ROOTFS."
 
mount -o rw $PART_ROOT $DIR_INSTALL
 
cd /
echo "Copy BIN"
tar -cf - bin | (cd $DIR_INSTALL; tar -xpf -)
#echo "Copy BOOT"
#mkdir -p $DIR_INSTALL/boot
#tar -cf - boot | (cd $DIR_INSTALL; tar -xpf -)
echo "Create DEV"
mkdir -p $DIR_INSTALL/dev
#tar -cf - dev | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy ETC"
tar -cf - etc | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy HOME"
tar -cf - home | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy LIB"
tar -cf - lib | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MEDIA"
mkdir -p $DIR_INSTALL/media
#tar -cf - media | (cd $DIR_INSTALL; tar -xpf -)
echo "Create MNT"
mkdir -p $DIR_INSTALL/mnt
#tar -cf - mnt | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy OPT"
tar -cf - opt | (cd $DIR_INSTALL; tar -xpf -)
echo "Create PROC"
mkdir -p $DIR_INSTALL/proc
echo "Copy ROOT"
tar -cf - root | (cd $DIR_INSTALL; tar -xpf -)
echo "Create RUN"
mkdir -p $DIR_INSTALL/run
echo "Copy SBIN"
tar -cf - sbin | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SELINUX"
tar -cf - selinux | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy SRV"
tar -cf - srv | (cd $DIR_INSTALL; tar -xpf -)
echo "Create SYS"
mkdir -p $DIR_INSTALL/sys
echo "Create TMP"
mkdir -p $DIR_INSTALL/tmp
echo "Copy USR"
tar -cf - usr | (cd $DIR_INSTALL; tar -xpf -)
echo "Copy VAR"
tar -cf - var | (cd $DIR_INSTALL; tar -xpf -)
 
echo "Copy fstab"
 
rm $DIR_INSTALL/etc/fstab
cp -a /root/fstab $DIR_INSTALL/etc/fstab
 
rm $DIR_INSTALL/root/install.sh
rm $DIR_INSTALL/root/fstab
rm $DIR_INSTALL/usr/bin/ddbr
rm $DIR_INSTALL/usr/bin/ddbr_backup_nand
rm $DIR_INSTALL/usr/bin/ddbr_backup_nand_full
rm $DIR_INSTALL/usr/bin/ddbr_restore_nand
 
 
cd /
sync
 
umount $DIR_INSTALL
 
echo "*******************************************"
echo "Complete copy OS to eMMC "
echo "*******************************************"

执行shutdown now关机断电,拔掉u盘后插电即可直接进入armbian

参考:
https://www.leonlu.cc/hobby/note005-phicomm-p1-linux/
https://isolated.site/2018/12/08/my-script-for-installing-armbian-5-67-into-phicomm-n1/

前端搭建

https://docs.v2board.com/deploy/aapanel.html
按照官方教程操作
避免出现问题 最好使用全新重装的系统按步骤操作 大佬随意
出现玄学的问题reboot重启vps也许就解决了

每次修改 .env 文件后需要执行以下命令重建缓存
php artisan config:cache

500错误尝试重新给予目录权限 在站点域名目录下执行
chown -R www:www *

后端搭建

https://github.com/ColetteContreras/v2ray-poseidon/wiki/0201-%E5%AF%B9%E6%8E%A5-V2board-%E6%95%99%E7%A8%8B

#一键脚本
curl -L -s https://raw.githubusercontent.com/ColetteContreras/v2ray-poseidon/master/install-release.sh | bash
#删除配置文件
rm /etc/v2ray/config.json
编辑配置文件
vi /etc/v2ray/config.json
重启v2ray
service v2ray restart

传输协议 伪装域名和路径的配置示例

{
    "path": "/路径",
    "headers": {
      "Host": "域名"
    }
}