..:: Diễn đàn lớp 07CK2 - ĐH.KHTN - TP.HCM ::..
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Lời Hay Ý Đẹp
Latest topics
» Tự học lập trình IOS trong vòng 24h
by kenanh 27/1/2014, 22:28

» xin tài liệu một số môn học
by nguyentvvan 21/8/2013, 21:34

» [Thảo luận] Bài toán đong nước
by giathinh9x 9/1/2013, 22:39

» Học Marketing Online, Học Chuyên viên Internet Marketing Online tại iNET
by NIIT-iNET 19/6/2012, 14:23

» Học PHP nâng cao, Học lập trình web với PHP nâng cao tại học viện iNET
by NIIT-iNET 19/6/2012, 14:22

» Học PHP, học lập trình web với PHP tại iNET vào ngày 19/07/2012
by NIIT-iNET 19/6/2012, 14:20

» PHIÊN BẢN MỚI CHO THIÊN ĐƯỜNG CÁ Ô LA LA !!!
by todaytv 13/3/2012, 15:35

» [hot] game khu vườn địa đàng phiên bản mobile của KVTM
by trantinh1713 3/1/2012, 15:20

» Đề tham khảo (update phút 90)
by ndc_2209 29/12/2011, 10:26

» Học bổng Lời Dịch tuần này.
by tienganh123 1/11/2011, 13:13

» [Thảo luận] Quản lý phân công giảng dạy PTTH
by huyquang0510 5/10/2011, 09:52

» Học tiếng Nhật - Top Globis
by tuquynh 21/9/2011, 10:35

» Học tiếng Nhật - Top Globis
by tuquynh 8/8/2011, 11:19

» Order Imitrex Online
by Khách viếng thăm 4/8/2011, 18:46

» Speeds Caffeine Metabolism Up
by Khách viếng thăm 4/8/2011, 18:12

» Skin For Good Caffeine
by Khách viếng thăm 3/8/2011, 14:54

» Cheap Pvc Figures
by Khách viếng thăm 1/8/2011, 19:32

» Action Rapid Onset Zolpidem Of
by Khách viếng thăm 31/7/2011, 01:13

» TUYỂN NHÂN VIÊN KINH DOANH ( làm việc tại văn phòng )
by canhkientp 5/7/2011, 14:59

» Demo + Vài điểm thảo luận về LINQ - Nhóm 7
by ChuongTienPhat 3/7/2011, 12:19


How to: Formatting Linux Filesystem

Go down

How to: Formatting Linux Filesystem Empty How to: Formatting Linux Filesystem

Bài gửi by ChuongTienPhat 28/5/2009, 16:52

Q. How do I format Linux file system? Can you tell me command names to format and create a Linux file system?

A.
Formatting linux filesystem required for many reasons. If you want to expand file system
or you just added new hard disk drive or create separate partitions for security and performance reasons. Whatever may be your reason(s) all file system creating involves creations of superblock, inode and other filesystem metadata structure. Fortunately, Linux comes with mkfs command to format filesystem. It is used to build a Linux file system
on a device, usually a hard disk partition. General syntax of mkfs is
as follows:
mkfs -t filetype /dev/DEVICE
OR
mkfs.ext3 /dev/DEVICE
Where,

  • -t filetype : File system type, it can be ext3, ext2, vfat etc
  • /dev/DEVICE : Your device name i.e. partition /dev/hda1 or /dev/sda1 etc.

An example
Suppose you would like to format /dev/hda5 with ext3 file system.
Step #1 Create the new filesystem with following command (first login in as a root user)
# mkfs.ext3 /dev/sda5
Output:

mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
30120 inodes, 120456 blocks
6022 blocks (5.00%) reserved for the super user
First data block=1
15 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Step # 2: Create mount point directory for the file system
# mkdir /datadisk1
Step # 3: Mount the new file system
# mount /dev/sda5 /datadisk1
Step # 4: Finally make sure file system /dev/hda5 automatically
mounted at /datadisk1 mount point after system reboots. You need to add
partition to /etc/fstab file. Use text editor such as vi to add
following entry


# vi /etc/fstab
Add/append following entry to file:
/dev/sda5 /datadisk1 ext3 defaults 0 2
Where,

  • /dev/sda5 : File system or parition name
  • /datadisk1 : Mount point
  • ext3 : File system type
  • defaults : Mount options (Read man page of mount command for all options)
  • 0 : Indicates whether you need to include or exclude this
    filesystem from dump command backup. Zero means this filesystem does
    not required dump.
  • 2 : It is used by the fsck program to determine the order in which
    filesystem checks are done at reboot time. The root (/) filesystem
    should be specified with a #1, and otherfilesystems should have a # 2
    value.

Save file and exit to shell prompt.


Được sửa bởi ChuongTienPhat ngày 28/5/2009, 16:59; sửa lần 1.
ChuongTienPhat
ChuongTienPhat
Admin
Admin

Nam
Tổng số bài gửi : 978
Age : 34
Registration date : 17/12/2007

http://360.yahoo.com/ztienphat2709z

Về Đầu Trang Go down

How to: Formatting Linux Filesystem Empty Re: How to: Formatting Linux Filesystem

Bài gửi by ChuongTienPhat 28/5/2009, 16:52

Luyện đọc hiểu với các tài liệu đơn giản 22222

Thêm 1 bài
về cài SCSI#2 trên Linux h5sh

Bước 1: Xác định tên của thiết bi

Vi ổ đĩa của bạn là SCSI nên tên device sẽ là /dev/sda , bạn có thể dùng lệnh fdisk để liệt kê các ổ đĩa :

fdisk -l

Disk /dev/sda: 255 heads, 63 sectors, 553 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 358 2771212+ 83 Linux
/dev/sda3 359 423 522112+ 83 Linux
/dev/sda4 424 553 1044225 5 Extended
/dev/sda5 424 553 1044193+ 83 Linux
Detected sgi disklabel with wrong checksum.

Disk /dev/sdb (SGI disk label): 255 heads, 63 sectors, 553 cylinders
Units = cylinders of 16065 * 512 bytes

----- partitions -----
Pt# Device Info Start End Sectors Id System
8: /dev/sdb1 1 552 8871912 c SGI xlv
9: /dev/sdb2 0 0 4029 0 SGI volhdr
11: /dev/sdb3 0 553 8888724 6 SGI volume
12: /dev/sdb4 1047 1048 32769 7fe73f00 SGI volhdr
13: /dev/sdb5 124276 124278 43423 41e882fe Unknown
14: /dev/sdb6 124276 56560 -1087838049 f000000 SGI volhdr
----- Bootinfo -----
Bootfile: /unix
----- Directory Entries -----
0: sgilabel sector 3 size 512
1: xlvlab sector 4 size 10752


Ở đây mình có 2 ổ SCSI la sda cho ổ 1 và /dev/sda cho /dev/sdb cho ổ
thứ hai. Mình giả sử trong trường hợp của bạn là /dev/hdc (Vì mình
không có một ổ SCSI có thể format đươc nhưng SCSI va IDE chỉ khác
nhau ở tên device khi bạn format, bạn cần thay đổi cho phù hợp với ổ đĩa
của bạn. )



Bước 2 dùng parted để tạo partition:


[root@ndt root]# parted
GNU Parted 1.6.3
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

Using /dev/hdc
Information: The operating system thinks the geometry on /dev/hdc is 623/255/63.

(parted)

+Chọn ổ đĩa ở đây mình chọn là ổ thứ 2 hdc

(parted) select /dev/hdc
Using /dev/hdc
Information: The operating system thinks the geometry on /dev/hdc is 623/255/63.

(parted)

+ Dùng lệnh print để kiểm tra lại

(parted) print
Disk geometry for /dev/hdc: 0.000-4892.036 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags


Trong phần này bạn cần để ý đến thông số Start(0.000) và End(4892.036 )

+Tạo partition bằng mkpart (mkpart PART-TYPE [FS-TYPE] START END )

(parted) mkpart primary ext3 0.000 4892.036

+ Kiểm tra partition mới tạo .Lưu ý là bạn phải thay đổi thông số Start, End,Type theo đúng ổ đĩa và yêu cầu của bạn.

(parted) print
Disk geometry for /dev/hdc: 0.000-4892.036 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 4886.960 primary ext3


Đến đây bạn đã tạo được partition rồi, bước kế tiếp là bạn sẽ format partition đó

Bước 3: format partition dùng mkfs theo định dạng ext3:

[root@ndt root]# /sbin/mkfs -t ext3 /dev/hdc1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
626496 inodes, 1251054 blocks
62552 blocks (5.00%) reserved for the super user
First data block=0
39 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Bước 4: Tạo thư mục bạn muốn mount ổ đĩa vào

[root@ndt root]# mkdir /mnt/disk2

Bược 5: Thêm môt dòng vào file fstab để khi boot nó sẽ tự động đựơc mount

/dev/hdc1 /mnt/disk2 ext3 defaults 1 1

Bước 6: Thử

+Nếu không muốn reboot máy bạn có thể dùng lệnh

[root@ndt root]# mount /dev/hdc1

+Dùng df đễ kiểm tra

[root@ndt root]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 8064272 5410652 2243968 71% /
none 257540 0 257540 0% /dev/shm
/dev/hdc1 4925528 32828 4642492 1% /mnt/disk2


nếu bạn thấy dòng thứ 4 thì coi như lệnh mount đã OK

+ dùng thử

[root@ndt root]# cd /mnt/disk2
[root@ndt disk2]# ls
lost+found
[root@ndt disk2]#


Tới đây là coi như hoàn tất . Có một lưu ý là bạn phải làm tất cả các bước này với username là root
Thân
NDT
ChuongTienPhat
ChuongTienPhat
Admin
Admin

Nam
Tổng số bài gửi : 978
Age : 34
Registration date : 17/12/2007

http://360.yahoo.com/ztienphat2709z

Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết