# dd if=/dev/zero of=test bs=1M count=1 seek=4000000
# ll test -h
-rw-r--r-- 1 root root 3.9T Sep 17 16:41 test
# du -s test
1024 test
# dd if=/dev/zero of=test1 bs=1M count=1 seek=17000000
dd: failed to truncate to 17825792000000 bytes in output file `test1': File too large
--在ext4下,单个文件最大大小为16T,再大的话就会报错
BIOS (Basic input and output system)
EFI/UEFI (Extensible Firmware Interface)
P primary主分区
E extend扩展分区
L logical逻辑扩展分区
4P
3P+1E(N个L)
-----------------------------------
fdisk (只能分msdos分区)
parted (可以分msdos和gpt分区)
如何确定你现在的磁盘使用的是哪此分区类型(msdos或gpt)?
# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA ST3500312CS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos --这里就可以看到类型
这两种分区格式怎么转换?
(parted) mklabel gpt --在parted里输入这样的命令去转换
Warning: Partition(s) on /dev/sda are being used.
Ignore/Cancel? --宿主机千W不要输入Ignore(表示忽略警告,直接干掉系统磁盘里的所有内容),输入Cancel取消或者ctrl+c取消
(parted) mklabel msdos
启动raid设备
1,有/etc/mdadm.conf配置文件的情况下
[root@raid ~]# mdadm -A /dev/md0
mdadm: /dev/md0 has been started with 2 drives.
[root@raid ~]# mdadm -A /dev/md1
mdadm: /dev/md1 has been started with 2 drives.
[root@raid ~]# mdadm -A /dev/md5
mdadm: /dev/md5 has been started with 4 drives.
[root@raid ~]# lvremove vg01 --移除四个卷
Do you really want to remove active logical volume lv01? [y/n]: y
Logical volume "lv01" successfully removed
Do you really want to remove active logical volume lv02? [y/n]: y
Logical volume "lv02" successfully removed
Do you really want to remove active logical volume lv03? [y/n]: y
Logical volume "lv03" successfully removed
Do you really want to remove active logical volume lv04? [y/n]: y
Logical volume "lv04" successfully removed
Volume group "lv01" not found
3,
[root@raid ~]# resize2fs /dev/vg01/lv01 --再使用这个命令去在线同步
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg01/lv01 is mounted on /mnt; on-line resizing required
Performing an on-line resize of /dev/vg01/lv01 to 393216 (4k) blocks.
The filesystem on /dev/vg01/lv01 is now 393216 blocks long.
[root@raid ~]# resize2fs /dev/vg01/lv01 1g --这样去缩小的话,报错已经mount了
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg01/lv01 is mounted on /mnt; on-line resizing required
On-line shrinking from 393216 to 262144 not supported.
[root@raid ~]# resize2fs /dev/vg01/lv01 1g --检测后再使用resize2fs命令缩小,并挂载查看大小是否缩小
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/vg01/lv01 to 262144 (4k) blocks.
The filesystem on /dev/vg01/lv01 is now 262144 blocks long.
[root@raid ~]# lvscan
ACTIVE '/dev/vg01/lv01' [1.50 GB] inherit --但这里查看的还是1.5g
ACTIVE '/dev/vg01/lv02' [1000.00 MB] inherit
[root@raid ~]# lvreduce -L 1g /dev/vg01/lv01 --所以lvreduce也要做
WARNING: Reducing active logical volume to 1.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv01? [y/n]: y
Reducing logical volume lv01 to 1.00 GB
Logical volume lv01 successfully resized
[root@raid ~]# lvscan
ACTIVE '/dev/vg01/lv01' [1.00 GB] inherit --OK
ACTIVE '/dev/vg01/lv02' [1000.00 MB] inherit
[root@raid ~]# lvremove /dev/vg01/snap01 --快照的移除
Do you really want to remove active logical volume snap01? [y/n]: y
Logical volume "snap01" successfully removed