擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Oct-14-09

FreeBSD Backup

posted by Thomas

環境介紹:kFreeBSD(與FreeBSD幾乎一樣)
Hardisk:建立兩個slice, 各自再兩個label
da0
da0s1
da0s1a / ufs2
da0s1b swap
da0s2
da0s2d /home
da0s2e /usr

mapping 到 linux kernel
da0 –> sda
da0s1 –> sda1 <bsd: sda5 sda6> // 暫時想像成延伸分割區吧
da0s1a / ufs2 –> sda5
da0s1b swap –> sda6
da0s2 –> sda2 <bsd: sda7 sda8>
da0s2d /home –> sda7
da0s2e /usr –> sda8

先用 Clonezilla 開機,進入shell模式,手動下指令:
raw backup:
dd if=/dev/sda of=mbr.dd bs=512 count=1
dd if=/dev/sda1 of=slice1-table.dd bs=512 count=16
dd if=/dev/sda2 of=slice2-table.dd bs=512 count=16
partclone.ufs -d -c -s /dev/sda5 -o sda5.ptl.img
partclone.ufs -d -c -s /dev/sda7 -o sda7.ptl.img
partclone.ufs -d -c -s /dev/sda8 -o sda8.ptl.img

restore:
dd if=mbr.dd of=/dev/sda
dd if=slice1-table.dd of=/dev/sda1
dd if=slice2-table.dd of=/dev/sda2
partclone.ufs -d -r -s sda5.ptl.img  -o /dev/sda5
partclone.ufs -d -r -s sda7.ptl.img  -o /dev/sda7
partclone.ufs -d -r -s sda8.ptl.img  -o /dev/sda8

直接pipe資料到新的硬碟:
dd if=/dev/sda of=/dev/sdb bs=512 count=1
partprobe /dev/sdb
dd if=/dev/sda1 of=/dev/sdb1 bs=512 count=16
dd if=/dev/sda2 of=/dev/sdb2 bs=512 count=16
reboot
partclone.ufs -d -b -s /dev/sda5 -o /dev/sdb5
partclone.ufs -d -b -s /dev/sda7 -o /dev/sdb7
partclone.ufs -d -b -s /dev/sda8 -o /dev/sdb8
remove sda, update sdb to first hard disk
boot…

other notes:
* 可以考慮備份硬碟前 0-62 這區段的sector, 雖然不確定是做什麼的?
* BSD建立partition 一律在尾端保留約 2678 個 sector,是否要備份?

* 為什麼slice 是 sda1的前16個sector
http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?bsdlabel+8
The offset of the start of the partition from the beginning of
the drive in sectors, or * to have bsdlabel calculate the correct
offset to use (the end of the previous partition plus one, ignor-
ing partition `c’).  For partition `c’, * will be interpreted as
an offset of 0.  The first partition should start at offset 16,
because the first 16 sectors are reserved for metadata.

* mount ufs2
mount -r -t ufs -o ufstype=ufs2 /dev/sda5 /mnt

* 判斷UFS partition

debian:~# dmesg | grep hda
[    3.440093] hda: VMware Virtual IDE Hard Drive, ATA DISK drive
[    4.112099] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[    4.112207] hda: UDMA/33 mode selected
[    5.208450] hda: max request size: 128KiB
[    5.208654] hda: 16777216 sectors (8589 MB) w/32KiB Cache, CHS=17753/15/63
[    5.208858]  hda: hda1
[    5.229445]  hda1: <bsd: hda5 hda6 >

————— check hda —————

debian:~# disktype /dev/hda

— /dev/hda
Block device, size 8 GiB (8589934592 bytes)
DOS/MBR partition map
Partition 1: 8.000 GiB (8589579264 bytes, 16776522 sectors from 63, bootable)
Type 0xA5 (FreeBSD)
FreeBSD boot loader (i386 boot1 at sector 0)
BSD disklabel (at sector 1), 8 partitions
Partition a: 7.500 GiB (8052708352 bytes, 15727946 sectors from 1048639)
Type 7 (4.2BSD fast file system)
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”
Partition b: 512 MiB (536870912 bytes, 1048576 sectors from 63)
Type 1 (swap)
Includes the disklabel and boot code
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”
Partition c: 8.000 GiB (8589579264 bytes, 16776522 sectors from 63)
Type 0 (Unused)

————— check hda5 —————

debian:~# disktype /dev/hda5

— /dev/hda5
Block device, size 7.500 GiB (8052708352 bytes)
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”

Aug-25-09

7月參加 LSM2009

posted by Thomas

LSM (Libre Software Meeting 法國自由軟體年會)為一在歐洲具有相當重要性的國際型自由軟體會議。每年在法國境內舉辦,其與會人員或參與組織以來自歐洲居多,也不乏許多來自美洲與亞洲人士。其會議涵蓋議題許多軟體開發、教育應用…等。
此行中心同仁將參與 OFSET 攤位展示中心自由軟體相關開發並於 『Education』演講一主題、與一場討論會,並於會後參加相關會議。主要行程如下:
1.與會並聽取會議相關簡報
2.DRBL/Clonezilla 攤位展示
3.Boss 演講:The diskless GNU/Linux and MS Windows solution
4.Boss Workshop: DRBL
….

在那邊比較特別的是跟使用者互動的過程中認識了許多新的朋友,大家都滿開心的!雖然語言沒有很通,但是大家一點都不介意,努力的表達自己的想法,非英語陰雨世界的國家也是很好玩的!

有關 Partclone,與用者提到:
讓 Clonezilla 支援 FreeBSD,Partclone 需要支援 UFS2 檔案系統(回過一個月已經完成一半,只差測試!)
Partclone 支援 BTRFS、ZFS 檔案系統(老掉牙但就是弄不出來)

LSM 是個自由且有趣的會議,獲得許多豐富的成果!