樹心幽徑

20190319在fedora 28裝 hp印表機驅動程式
2019/03/19,13:00

REF:https://forums.fedoraforum.org/showthread.php?317051-How-to-install-HP-printer-on-Fedora-Linux

(1)$ sudo dnf install hplip-gui

(2) 執行 hplip-gui
20190318在linux LVM建立多個lv邏輯分割區
2019/03/18,11:16

REF1:https://ithelp.ithome.com.tw/articles/10080861

REF2:https://sc8log.blogspot.com/2017/03/linux-lvm-lvm.html

(0)$ sudo fdisk -l /dev/sda
[sudo] password for treehrt:
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 0CDEAD93-994C-453E-A240-EB952B15039B

所用裝置        Start       結束       磁區   Size 類型
/dev/sda1        2048     534527     532480   260M EFI System
/dev/sda2      534528     567295      32768    16M Microsoft reserved
/dev/sda3      567296  629712895  629145600   300G Microsoft basic data
/dev/sda4   629712896  631810047    2097152     1G Linux filesystem
/dev/sda5  1949788160 1951426559    1638400   800M Windows recovery environment
/dev/sda6   631810048 1949788159 1317978112 628.5G Linux LVM
/dev/sda7  1951426560 1953525134    2098575     1G Linux filesystem

Partition table entries are not in disk order.

(1)$ sudo pvscan
  PV /dev/sda6   VG fedora          lvm2 [<628.46 GiB / <605.69 GiB free]
  Total: 1 [<628.46 GiB] / in use: 1 [<628.46 GiB] / in no VG: 0 [0   ]

(2)$ sudo pvdisplay

  --- Physical volume ---
  PV Name               /dev/sda6
  VG Name               fedora
  PV Size               628.46 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              160885
  Free PE               155056
  Allocated PE          5829
  PV UUID               TzQpnt-3D8g-z8gf-oYyg-cPre-kxAR-80qnD2

(3)$ sudo lvcreate -L 20476M -n fclv01 fedora
  Logical volume "fclv01" created.

[treehrt@sice ~]$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda6
  VG Name               fedora
  PV Size               628.46 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              160885
  Free PE               149937
  Allocated PE          10948
  PV UUID               TzQpnt-3D8g-z8gf-oYyg-cPre-kxAR-80qnD2

(4)$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/fedora/root
  LV Name                root
  VG Name                fedora
  LV UUID                1oNhCv-IfPQ-tRWq-PLJy-F8v3-IvHK-NZnqXn
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-01-19 10:42:25 +0800
  LV Status              available
  # open                 1
  LV Size                15.00 GiB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  
  --- Logical volume ---
  LV Path                /dev/fedora/swap
  LV Name                swap
  VG Name                fedora
  LV UUID                DixTjC-5f3p-ENYr-p3fF-azJA-vTiK-3nFYGe
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-01-19 10:42:26 +0800
  LV Status              available
  # open                 2
  LV Size                <7.77 GiB
  Current LE             1989
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
  
  --- Logical volume ---
  LV Path                /dev/fedora/fclv01
  LV Name                fclv01
  VG Name                fedora
  LV UUID                Uvjj2Y-lBQ0-V3Mu-42Ui-Mzav-9bns-UU4qR8
  LV Write Access        read/write
  LV Creation host, time sice.kmvs.km.edu.tw, 2019-03-18 11:39:23 +0800
  LV Status              available
  # open                 0
  LV Size                <20.00 GiB
  Current LE             5119
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
  
(5)$ sudo mkfs.xfs /dev/fedora/fclv01
meta-data=/dev/fedora/fclv01     isize=512    agcount=4, agsize=1310464 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=5241856, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

(6)$ mkdir lvmdata

$ pwd
/home/treehrt

(7)$ sudo mount /dev/fedora/fclv01 /home/treehrt/lvmdata

(8)$ df -h
檔案系統                   容量  已用  可用 已用% 掛載點
devtmpfs                   3.9G     0  3.9G    0% /dev
tmpfs                      3.9G   60M  3.8G    2% /dev/shm
tmpfs                      3.9G  1.9M  3.9G    1% /run
tmpfs                      3.9G     0  3.9G    0% /sys/fs/cgroup
/dev/mapper/fedora-root     15G   15G  710M   96% /
tmpfs                      3.9G  316K  3.9G    1% /tmp
/dev/sda4                  976M  126M  783M   14% /boot
/dev/sda1                  256M   33M  224M   13% /boot/efi
tmpfs                      783M   16K  783M    1% /run/user/42
tmpfs                      783M  3.5M  779M    1% /run/user/1000
/dev/mapper/fedora-fclv01   20G   53M   20G    1% /home/treehrt/lvmdata

 

(9)$ sudo vi /etc/fstab
(10)$ cat /etc/fstab
:

/dev/mapper/fedora-root /                       xfs     defaults        0 0
/dev/mapper/fedora-fclv01 /home/treehrt/lvmdata        xfs     defaults        0 0
:

/dev/mapper/fedora-swap swap                    swap    defaults        0 0

 

20190314用php程式加入一筆資料到ms-access2000資料庫檔(selldb.accdb)的goods資料表中 (b2.php)
2019/03/14,15:58

<body bgcolor=pink>

<?php

$constr="Provider=Microsoft.ACE.OLEDB.12.0;Data Source = d:\selldb.accdb";

$con = new com("ADODB.Connection");

$con->Open($constr);

$sql="insert into goods (gdsno,gdsname,cost,price,stock_qty,unit,fac_no,mem) values ('101','plum' ,30,40,2000,'li','f01','goodlone')";

$con->execute($sql);

?>

</body>

20190311在windows裝qemu
2019/03/14,10:57

REF:http://jamyy.us.to/blog/2013/07/5104.html

 

(1)下載qemu-w64-setup-20181127.exe (100M QEMU Installer for Windows 64 bit)並執行之

(2)下載 HBCD_PE_x64.iso (Hiren’s BootCD PE x64 v1.0.1 約1.3GB)

(3)執行 qemu-system-x86_64 -cdrom HBCD_PE_x64.iso -boot d -m 4096

 

Part II:建立XP虛擬機

[作業系統] WIN XP SP3 繁體中文原版 ISO 下載WINXP_SP3_TW.iso (604.6 MB) 

(4)建立xp虛擬硬碟檔 $

$ qemu-img create -f qcow2 xp.img 10G
Formatting 'xp.img', fmt=qcow2 size=10737418240 cluster_size=65536 lazy_refcounts=off refcount_bits=16

(5)建立xp安裝光碟的iso檔: $ dd if=/dev/cdrom of=xp.iso bs=2048 conv=sync,notrunc

[treehrt@sice ~]$ dd if=/dev/cdrom of=xp.iso bs=2048 conv=sync,notrunc
309216+0 records in
309216+0 records out
633274368 bytes (633 MB, 604 MiB) copied, 131.905 s, 4.8 MB/s


(6)用xp安裝光碟iso檔(xp.iso)將WINDOWS XP 裝在xp虛擬硬碟檔(xp.img)中:

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G  -cdrom xp.iso

 qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -net bridge,br=br0 -net nic,model=virtio

(6-2)

$ dd if=/dev/zero of=mapsource.img count=950000 bs=1KiB
950000+0 records in
950000+0 records out
972800000 bytes (973 MB, 928 MiB) copied, 24.9261 s, 39.0 MB/s

$ losetup --show -f mapsource.img
losetup: cannot find an unused loop device
[treehrt@sice xp]$ sudo losetup --show -f mapsource.img
[sudo] password for treehrt:
/dev/loop0

$ sudo parted /dev/loop0 -s mklabel gpt mkpart EFI FAT16 1MiB 100% toggle 1 boot
[treehrt@sice xp]$ sudo mkfs -t msdos /dev/loop0p1
mkfs.fat 4.1 (2017-01-24)

 

$ sudo mount /dev/loop0p1 mapsource

:

$ sudo cp garmin/MapSource6_11_3CHT.exe mapsource

$ sudo cp MapSrcSerial.unl mapsource

$ sudo cp -R Dakota mapsource

[treehrt@sice xp]$ sudo umount /dev/loop0p1

(6-3)

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -drive if=ide,format=raw,file=mapsource.img  -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139

順利上網成功

 

(6-4) 掛第2顆硬碟:

REF:http://www.suares.com/index.php?page_id=25&news_id=209

$qemu-img create -f raw dsk2.raw 4G

$ sudo losetup /dev/loop0 dsk2.raw

$ sudo fdisk -u /dev/loop0

:

命令 (m 以獲得說明):p
Disk /dev/loop0: 4 GiB, 4294967296 bytes, 8388608 sectors
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: 0x0d9b4703

命令 (m 以獲得說明):n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
分割區編號 (1-4, default 1):
First sector (2048-8388607, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-8388607, default 8388607):

Created a new partition 1 of type 'Linux' and of size 4 GiB.

命令 (m 以獲得說明):t

Hex code (type L to list all codes): 86
Changed type of partition 'Linux' to 'NTFS volume set'.

命令 (m 以獲得說明):w

:

$ sudo losetup -d /dev/loop0

$ qemu-img convert -f raw dsk2.raw -O qcow dsk2.img

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -hdd dsk2.img -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139

 

(6-5) 拷入mapsource

$ sudo losetup --show -f dsk2.raw
/dev/loop0

$  sudo mkfs -t msdos /dev/loop0
mkfs.fat 4.1 (2017-01-24)
[treehrt@sice xp]$  sudo mount /dev/loop0 mapsource

:

$ sudo cp -r garmin/bin mapsource/

$ sudo cp -r garmin/*.unl mapsource/

$ sudo cp -r garmin/MapSource6_11_3CHT.exe mapsource/

:

$ ls mapsource/
bin  MapSource6_11_3CHT.exe  MapSrcSerial.unl

$  sudo umount /dev/loop0

$ sudo losetup -d /dev/loop0

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -hdd dsk2.img (沒成功)

(6-6)

$ dd if=/dev/cdrom of=vb6.iso bs=2048 conv=sync,notrunc
284424+0 records in
284424+0 records out
582500352 bytes (583 MB, 556 MiB) copied, 123.741 s, 4.7 MB/s

$ qemu-system-i386 -enable-kvm -drive file=xp.img,format=qcow2 -m 2G -cdrom vb6.iso -net bridge,br=br0 -net nic,model=virtio -net nic,model=rtl8139


alt

 

Part III:建立win7虛擬機

(8)建立win7虛擬硬碟檔:
$ qemu-img create -f qcow2 win7.img 20G
Formatting 'win7.img', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off

(9)建立win7安裝光碟的iso檔:

$ dd if=/dev/cdrom of=win7.iso bs=2048 conv=sync,notrunc
1754432+0 records in
1754432+0 records out
3593076736 bytes (3.6 GB) copied, 642.98 s, 5.6 MB/s

(10)用win7安裝光碟iso檔(win7.iso)將WINDOWS 7 裝在win7虛擬硬碟檔(win7.img)中:

$ qemu-system-x86_64 -enable-kvm -drive file=win7.img,format=qcow2 -m 1G  -cdrom win7.iso

Part V:建立fedora 28虛擬機

$ qemu-img create -f qcow2 fc28.img 20G
Formatting 'fc28.img', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off

$ qemu-system-x86_64 -enable-kvm -drive file=fc28.img,format=qcow2 -m 1G  -cdrom Fedora-Server-netinst-x86_64-28-1.1.iso

 

20190312製作HBCD_PE_x64.iso及antiX-17.4_x64-full.iso開機隨身碟
2019/03/12,10:03

REF:201704把 Windows XP 收納成 qemu 虛擬機

REF2:20190118製作Fedora Server’s netinst images隨身碟

REF3: extlinux 開機隨身碟

(1)$ lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 931.5G  0 disk
├─sda1         8:1    0   260M  0 part /boot/efi
├─sda2         8:2    0    16M  0 part
├─sda3         8:3    0   300G  0 part
├─sda4         8:4    0     1G  0 part /boot
├─sda5         8:5    0   800M  0 part
└─sda6         8:6    0 628.5G  0 part
  ├─fedora-root
  │          253:0    0    15G  0 lvm  /
  └─fedora-swap
             253:1    0   7.8G  0 lvm  [SWAP]
sdc            8:32   1  57.9G  0 disk
├─sdc1         8:33   1   583M  0 part /run/media/treehrt/Fedora-S-dvd-x86_64-28
├─sdc2         8:34   1   9.1M  0 part
└─sdc3         8:35   1  19.2M  0 part
sr0           11:0    1  1024M  0 rom 

 

(2)$ umount  /run/media/treehrt/Fedora-S-dvd-x86_64-28
[treehrt@sice ~]$ lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 931.5G  0 disk
├─sda1            8:1    0   260M  0 part /boot/efi
├─sda2            8:2    0    16M  0 part
├─sda3            8:3    0   300G  0 part
├─sda4            8:4    0     1G  0 part /boot
├─sda5            8:5    0   800M  0 part
└─sda6            8:6    0 628.5G  0 part
  ├─fedora-root 253:0    0    15G  0 lvm  /
  └─fedora-swap 253:1    0   7.8G  0 lvm  [SWAP]
sdc               8:32   1  57.9G  0 disk
├─sdc1            8:33   1   583M  0 part
├─sdc2            8:34   1   9.1M  0 part
└─sdc3            8:35   1  19.2M  0 part
sr0              11:0    1  1024M  0 rom 
[treehrt@sice ~]$

(3)列出自Hiren's Boot CD事先下載的iso檔

$ ls iso -l
總計 2214964
-rw-rw-r--. 1 treehrt treehrt 1354811392  3月 11 16:00 HBCD_PE_x64.iso
-rw-rw-r--. 1 treehrt treehrt  913309696  3月 11 16:16 systemrescuecd-6.0.2.iso

(4)$ sudo dd if=iso/HBCD_PE_x64.iso of=/dev/sdc bs=1M

1292+1 records in
1292+1 records out
1354811392 bytes (1.4 GB, 1.3 GiB) copied, 54.524 s, 24.8 MB/s

(5)$ df
檔案系統                 1K-區段     已用    可用 已用% 掛載點
:

/dev/sdc                 1322450  1322450       0  100% /run/media/treehrt/HBCD_PE_x64

 

(6)$ tree /run/media/treehrt/HBCD_PE_x64
/run/media/treehrt/HBCD_PE_x64
├── Boot
│   ├── BCD
│   ├── bootfix.bin
│   ├── boot.sdi
│   ├── en-us
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── Fonts
│   │   ├── chs_boot.ttf
│   │   ├── cht_boot.ttf
│   │   ├── jpn_boot.ttf
│   │   ├── kor_boot.ttf
│   │   ├── malgun_boot.ttf
│   │   ├── malgunn_boot.ttf
│   │   ├── meiryo_boot.ttf
│   │   ├── meiryon_boot.ttf
│   │   ├── msjh_boot.ttf
│   │   ├── msjhn_boot.ttf
│   │   ├── msyh_boot.ttf
│   │   ├── msyhn_boot.ttf
│   │   ├── segmono_boot.ttf
│   │   ├── segoen_slboot.ttf
│   │   ├── segoe_slboot.ttf
│   │   └── wgl4_boot.ttf
│   ├── memtest.exe
│   └── Resources
│       └── bootres.dll
├── bootmgr
├── bootmgr.efi
├── EFI
│   ├── Boot
│   │   ├── bootx64.efi
│   │   └── en-us
│   │       └── bootx64.efi.mui
│   └── Microsoft
│       └── Boot
│           ├── BCD
│           ├── en-us
│           │   └── memtest.efi.mui
│           ├── Fonts
│           │   ├── chs_boot.ttf
│           │   ├── cht_boot.ttf
│           │   ├── jpn_boot.ttf
│           │   ├── kor_boot.ttf
│           │   ├── malgun_boot.ttf
│           │   ├── meiryo_boot.ttf
│           │   ├── msjh_boot.ttf
│           │   ├── msyh_boot.ttf
│           │   ├── segmono_boot.ttf
│           │   ├── segoe_slboot.ttf
│           │   └── wgl4_boot.ttf
│           ├── memtest.efi
│           └── Resources
│               └── bootres.dll
├── en-us
│   └── bootmgr.efi.mui
├── HBCD_PE.ini
├── sources
│   └── boot.wim
└── Version.txt

14 directories, 46 files

(7)視窗用戶:

Download ISO2USB.exe to your computer.

 

 

(8) 下載antiX-17.4_x64-full.iso

(9-1) $  sudo dd if=iso/antiX-17.4_x64-full.iso of=/dev/sdc bs=1M
[sudo] password for treehrt:
952+0 records in
952+0 records out
998244352 bytes (998 MB, 952 MiB) copied, 33.8932 s, 29.5 MB/s
[treehrt@sice ~]$

(9-2)用antiX-17.4_x64-full.iso開機隨身碟開機成功。

 

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType