JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

Handle the hard disk with 2TB through the command of parted


OMG,又到了該發廢文的時候了,偏偏想不出來要寫啥米,突然想到前天浚哥問我割哈滴摳逼畢個File的Preparation,因為他要八個槽(不是洗油槽@@"),而且每個槽要容納300G的Single File,所以Total Size大於2TB,進而導致MBR沒辦法Handle;因此要用GPT做Partition Table的管理,又很巧在SLES 11 SP3裡面並沒有GDisk的Tool,只能硬著頭皮用著不熟的Parted,還好後來靠估狗大神救援可能漏氣的機會,所以當然要紀錄一下,免得下次忘記又給學弟漏氣了;怎麼弄!?讓我們看下去吧,如下:

1) Assign the label with gpt
#parted -s /dev/sdb mklabel gpt
#parted -s /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags

2) Assign the partitions with /dev/sdb(30%、20%、20% and 30%,如果是Boot磁碟可加Boot On)
#parted -s /dev/sdb mkpart logical ext4 0% 30%
#parted -s /dev/sdb mkpart logical ext4 30% 50%
#parted -s /dev/sdb mkpart logical ext4 50% 70%
#parted -s /dev/sdb set 1 boot on
#parted -s /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 6442MB 6441MB logical
2 6442MB 10.7GB 4295MB logical
3 10.7GB 15.0GB 4295MB logical

3) Delete the /dev/sdb3
#parted -s /dev/sdb rm 3
#parted -s /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 6442MB 6441MB logical
2 6442MB 10.7GB 4295MB logical

4) Automate the assignment of partitions
#parted -s /dev/sdb mkpart logical ext4 0% 10%
#for i in {1..7} ; do mkpart logical ext4 ${i}0% $((i+1))0% ; done
#parted -s /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 2147MB 2146MB logical
2 2147MB 4295MB 2147MB logical
3 4295MB 6442MB 2147MB logical
4 6442MB 8590MB 2147MB logical
5 8590MB 10.7GB 2147MB logical
6 10.7GB 12.9GB 2147MB logical
7 12.9GB 15.0GB 2147MB logical
8 15.0GB 17.2GB 2147MB logical

5) Format a partitions、mount and produce a big file quickly
#mkfs.ext4 /dev/sdb1
#mkdir -p /fsb1
#mount /dev/sdb1 /fsb1
#truncate -s 300G bigfile

◎、以上就是Handle the hard disk with 2TB through the command of parted的簡介,至於其他操作的部份可以參考Thegeekstuff這篇文章,這篇也蠻廢的吧,不過還是要告一段落囉,先到這,收工哩!

  1. 嗨 水電工 非常喜歡您寫的文章呢! 不過這篇有幾個問題想請教
    1. 第三項-清除sdb3,好像沒有附上指令呢!
    2. 第四項-auto assign那邊,可以改成
    #for i in {0..7} ; do parted -s /dev/sdb mkpart logical ext4 ${i}0% $((i+1))0% ;done 這樣嗎?

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro