2012年7月13日 星期五

mount cd-rom or iso-files

in Linux:
mount -t iso9660 -o loop [path to iso file] [dest path]
cdrom device : /dev/sr0

in Mac:

sudo mount_cd9660 [path to iso file] [dest path]

sudo mount -t hfs -o nodev,nosuid,ro [path to cd-rom device] [dest path]

cdrom device maybe linked to /dev/disk1s0s2 (@virtual machine)

2012年7月11日 星期三

mkisofs

一般我們在維護系統時, 總會經常使用iso檔來存取, 尤其當要掛載虛擬光碟或虛擬機使用
windows上我們常有用酒精或其他工具來產生iso檔,
那在linux上呢?

mkisofs便可以自定義想要產生的iso檔內容
mkisofs -o doc.iso ~/doc
如此便可以將你家目錄下的doc目錄內資料, 全部收錄到doc.iso的鏡像檔裡

那如果我要複雜一點呢
mkisofs -A "CENTOS6_BOOT" -V "CENTOS6_BOOT" -J -R -v -T -o centos6_boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table isolinux

這個是產生一個可以開機的iso檔,
注意: 在建立時,
    (1)目錄裡的TRANS.TBL若在錄製時有錯誤,請將他移除(上例中的isolinux/TRANS.TBL)
    (2)-b以及-c指定從錄製目標(dest)起算的檔案及路徑, 決定方法如下:
        假設你想要在 /var/ftp下(執行指令的位置),
        去錄製/var/ftp/pub成為centos.iso(實際燒錄資料,dest),
        isolinux的位置在 /var/ftp/pub/isolinux
        指令的內容應該
        [root@local /var/ftp ]# mkisofs .... -b isolinux/isolinux.bin -c isolinux/boot.cat .... /var/ftp/pub

以下舉例, 把原始的光碟, 不透過dd的指令, 而採用mkisofs來建立iso檔(此法可以用來建立自定義的安裝光碟, 光碟片一放進去便可自動安裝的方法快速部署光碟片, 當然在區域網路透過PXE - kickstart是較快的)
(1)假設CentOS整片光碟資料已在~/centos/目錄下(不管是mount光碟或備份一份)
(2)isolinux在~/centos/isolinux/下
(3)依照你想要的部分, 修改kickstart檔, 或者開機相關參數(這部分有機會我再PO文)
(4)如下建立centos.iso安裝鏡像檔(此時或許可以不用修改TRANS.TBL檔)
[root@local ~ ]mkisofs -A "CENTOS_DVD" -V "CENTOS_DVD" -J -R -v -T -o centos.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table centos
    藍字粗體centos為要錄製的目標目錄

2012年7月4日 星期三

(Pseudo-)Enable root in Mac OSX Snow Leopard

To enable root in terminal, Try "dsenableroot". You wil be prompted for your password and then what you want as root password and then a confirmation of the root password. "dsenablerood -d" disbles the root password


Here is part or the man page.


dsenableroot -- enables or disables the root account.


SYNOPSIS


dsenableroot [-d] [-u username] [-p password] [-r rootPassword]


DESCRIPTION
dsenableroot sets the password for the root account if enabling the root user account. Otherwise, if disable [-d] is chosen, the root account passwords are removed and the root user is disabled.


A list of flags and their descriptions:


-u username
Username of a user that has administrative privileges on this computer.


-p password
Password to use in conjunction with the specified username. If this is not specified, you will be prompted for
entry.


-r rootPassword
Password to be used for the root account. If this is not specified for enabling, you will be prompted for
entry.



There's no reason I'm aware of to enable the root user. If you need to do things as root, simply type sudo -s in the Terminal to start a shell with root access and proceed from there.


or

use sudo su - which makes sure that you keep the same shell settings as you had in you administrator settings



reference: http://hints.macworld.com/article.php?story=20090909081659323

文章分類