Red Hat Linux 5.2 14T大文件系统 分区过程
<<< Log from 210.42.35.61 started 五月 22, 2010, 14:49:01 >>>
[root@Backup-ctgu /]#parted /dev/sdd (用parted分区)
GNU Parted 1.8.1
Using /dev/sdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabelgpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No?yes
New disk label type? [gpt]?
(parted)print
Model: IBM VirtualDisk (scsi)
Disk /dev/sdd: 14.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
(parted)mklabel gpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No?yes
New disk label type? [gpt]?
(parted)mkpart primary 0 -1 (只分一个区)
(parted)print
Model: IBM VirtualDisk (scsi)
Disk /dev/sdd: 14.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 14.0TB 14.0TB primary
(parted)quit
Information: Don't forget to update /etc/fstab, if necessary.
[root@Backup-ctgu /]#partprobe
No Implementation: Support for adding partitions to AIX disk labels is not implemented yet.
No Implementation: Support for adding partitions to AIX disk labels is not implemented yet.
No Implementation: Support for reading AIX disk labels is is not implemented yet.
[root@Backup-ctgu /]#parted
GNU Parted 1.8.1
浣跨?/dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select sdd 浣?
(parted) quit
淇℃?瑕蹇璁版姘 /etc/fstab?
瑕锛涓
[root@Backup-ctgu /]#export LANG=en (操作系统默认是中文,改英文,不然有上面的乱码)
[root@Backup-ctgu /]#parted /dev/sdd
GNU Parted 1.8.1
Using /dev/sdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)help
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [free|NUMBER|all] display the partition table, a partition, or all devices
quit exit program
rescue START END rescue a lost partition near START and END
resize NUMBER START END resize partition NUMBER and its file system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version displays the current version of GNU Parted and copyright information
(parted) print
Model: IBM VirtualDisk (scsi)
Disk /dev/sdd: 14.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 14.0TB 14.0TB primary
(parted)mkfs
Warning: The existing file system will be destroyed and all data on the partition will be lost. Do you want to
continue?
Yes/No? yes
Partition number? 1
File system? [ext2]?ext3 (parted不支持ext3)
No Implementation: Support for creating ext3 file systems is not implemented yet.
(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.
[root@Backup-ctgu /]#fdisk -l (fdisk看不到用parted分的区)
Disk /dev/sda: 145.9 GB, 145999527936 bytes
255 heads, 63 sectors/track, 17750 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 2114 16779892+ 82 Linux swap / Solaris
/dev/sda3 2115 17750 125596170 83 Linux
WARNING: GPT (GUID Partition Table) detected on '/dev/sdd'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdd: 13995.3 GB, 13995327094784 bytes
255 heads, 63 sectors/track, 1701501 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 267350 2147483647+ ee EFI GPT
There is a valid AIX label on this disk.
Unfortunately Linux cannot handle these
disks at the moment. Nevertheless some
advice:
1. fdisk will destroy its contents on write.
2. Be sure that this disk is NOT a still vital
part of a volume group. (Otherwise you may
erase the other disks as well, if unmirrored.)
3. Before deleting this physical volume be sure
to remove the disk logically from your AIX
machine. (Otherwise you become an AIXpert).
Disk /dev/sde: 329.8 GB, 329853488128 bytes
255 heads, 63 sectors/track, 40102 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
[root@Backup-ctgu /]#mkfs -t ext3 -b 8192 /dev/sdd1 (打算用8K的数据块,但格式化时间太长,不想等)
Warning: blocksize 8192 not usable on most systems.
mke2fs 1.39 (29-May-2006)
mkfs.ext3: 8192-byte blocks too big for system (max 4096)
Proceed anyway? (y,n)n
[root@Backup-ctgu /]#cat /etc/mke2fs.conf (文件系统支持的块如下)
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index
blocksize = 4096
inode_ratio = 8192
[fs_types]
small = {
blocksize = 1024
inode_ratio = 4096
}
floppy = {
blocksize = 1024
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
}
largefile4 = {
inode_ratio = 4194304
}
[root@Backup-ctgu /]# mkfs.ext3 -T largefile4 /dev/sdd1 -F (用4M的块强制格式化,10分钟左右完成14T)
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3336768 inodes, 3416827895 blocks
170841394 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
104274 block groups
32768 blocks per group, 32768 fragments per group
32 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@Backup-ctgu /]#
[root@Backup-ctgu /]#
[root@Backup-ctgu /]# ls
bin dev dsmserv.err export lib lost+found misc net proc sbin srv tftpboot tsm var
boot ds4700 etc home lib64 media mnt opt root selinux sys tmp usr
[root@Backup-ctgu /]#mount /dev/sdd1 /tsm (mount文件系统)
[root@Backup-ctgu /]#df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 121659892 29560596 85819488 26% /
/dev/sda1 194442 21469 162934 12% /boot
tmpfs 3013012 0 3013012 0% /dev/shm
/dev/sdd1 13665981956 151296 12982465084 1% /tsm
[root@Backup-ctgu ~]#vi /etc/fstab (开机自动mount)
LABEL=/ / ext3 defaults 1 1
LABEL=/boot1 /boot ext2 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sdd1 /tsm ext3 defaults 0 0
[root@Backup-ctgu ~]#
<<< Log from 210.42.35.61 ended 五月 22, 2010, 15:55:27 >>>
总结:
一、关于分区:
parted是Red Hat Enterprise Linux 5.2下自带的另外一款分区软件,相对于fdisk,它的使用更加方便,同时它还提供了动态调整分区大小的功能。本节将介绍如何通过parted创建、删除磁盘分区、查看分区表、更改分区大小、创建文件系统以及如何使用parted的交互模式等。
parted简介
parted是另一款在Linux下常用的分区软件,它支持的分区类型范围非常广,包括ext2、ext3、linux-swap、FAT、FAT32、reiserfs、HFS、jsf、ntfs、ufs和xfs等。无论是Linux还是Windows,它都能很好地支持。其命令格式如下:
parted [options] [device [command [options...]...]]
其中的命令选项说明如下所述。
● -h:显示帮助信息。
● -i:交互模式。
● -s:脚本模式。
● -v:显示parted的版本信息。
● device:磁盘设备名称,如/dev/hda。
● command:parted指令,如果没有设置指令,则parted将会进入交互模式,parted指令将会在7.3.2节中详细介绍。
例如要查看parted的版本信息,其命令如下所示。
# parted -v
GNU Parted 1.8.1
可以看到,系统当前使用的parted版本为1.8.1。
二、关于文件系统限制
红帽ext3文件系统所支持的max file size和max filesystem size如图
Ext3
最大文件大小: 2TB
最大文件极限: 仅受文件系统大小限制
最大分区/文件系统大小: 4TB
最大文件名长度: 255 字符
缺省最小/最大块大小: 1024/4096 字节
缺省inode分配: 每4096字节为1
在强制FS检查前的最大装载: 20(可配置
三、关于块大小:
创建文件系统时,可以指定块的大小。如果将来在你的文件系统中是一些比较大的文件的话,使用较大的块大小将得到较好的性能。将ext2文件系统的块大小调整为4096byte而不是缺省的1024byte,可以减少文件碎片,加快fsck扫描的速度和文件删除以及读操作的速度。另外,在ext2的文件系统中,为根目录保留了5%的空间,对一个大的文件系统,除非用作日志文件,5%的比例有些过多。可以使用命令"# mke2fs -b 4096 -m 1 /dev/hda6"将它改为1%并以块大小4096byte创建文件系统。
使用多大的块大小,需要根据你的系统综合考虑,如果系统用作邮件或者新闻服务器,使用较大的块大小,虽然性能有所提高,但会造成磁盘空间较大的浪费。比如文件系统中的文件平均大小为2145byte,如果使用4096byte的块大小,平均每一个文件就会浪费1951byte空间。如果使用1024byte 的块大小,平均每一个文件会浪费927byte空间。在性能和磁盘的代价上如何平衡,要看具体应用的需要。
使用多大的块大小,需要根据你的系统综合考虑,如果系统用作邮件或者新闻服务器,使用较大的块大小,虽然性能有所提高,但会造成磁盘空间较大的浪费。比如文件系统中的文件平均大小为2145byte,如果使用4096byte的块大小,平均每一个文件就会浪费1951byte空间。如果使用1024byte 的块大小,平均每一个文件会浪费927byte空间。在性能和磁盘的代价上如何平衡,要看具体应用的需要。