2007年5月11日星期五

Linux tutorial 3 -- Filesystem

* creating partitions
on x86 machines, hard disks may be divided into 4 primary partitions, but the last one may contain a number of extended partitions.

list partition table

fong:/home/fong/ebooks/linux/LPI # fdisk -l

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 1913 15366141 83 Linux
/dev/hda2 1914 7296 43238947+ f W95 Ext'd (LBA)
/dev/hda5 1914 2175 2104483+ 82 Linux swap / Solaris
/dev/hda6 2176 4134 15735636 83 Linux
/dev/hda7 4135 7296 25398733+ 83 Linux

List the mounted filesystem tab
fong:/home/fong/ebooks/linux/LPI # cat /etc/fstab
/dev/hda6 / reiserfs acl,user_xattr 1 1
/dev/hda7 /home reiserfs acl,user_xattr 1 2
/dev/hda5 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/hda1 /local reiserfs acl,user_xattr 1 2

or
fong:/home/fong/ebooks/linux/LPI # mount
/dev/hda6 on / type reiserfs (rw,acl,user_xattr)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/hda7 on /home type reiserfs (rw,acl,user_xattr)
/dev/hda1 on /local type reiserfs (rw,acl,user_xattr)
securityfs on /sys/kernel/security type securityfs (rw)

create a filesystem
fong:/home/fong/ebooks/linux/LPI # fdisk /dev/hda


* Make a filesystem in a partition
mkfs -t

* Make an ISO filesystem with mkisofs
% mkisofs -o ProjectCD.iso -r ~/project-files ~/project-extras

* Make an ISO filesystem with cdrecord
finding a recordable device
% cdrecord -scanbus

% sudo cdrecord -overburn -v speed=16 dev=1,0,0
/media/KNOPPIX_V3.6-2004-08-16-EN.iso

* Make an ISO filesystem with dd
% dd if=/dev/cdrom of=project-cd.iso

* Default mounting /etc/fstab
#
proc /proc proc defaults 0 0
/dev/sda3 / reiserfs notail 0 1
/dev/sda5 none swap sw 0 0
/dev/sda6 /home ext3 rw 0 2
/dev/scd0 /media/cdrom0 udf,iso9660 ro,user,noauto 0 0
/media/Ubuntu-5.04-install-i386.iso /media/Ubuntu_5.04 iso9660
rw,loop 0 0

:
:
: 1 for root fs, 2 for other fs.

* Automounting with AMD and automount
/etc/auto.master

* Fixing a fs with fsck

* checking fs with badblocks

没有评论: