root@6[~]# dmesg | grep hd ← 寻找硬盘
ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda: DMA, hdb: pio
ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc: pio, hdd: DMA
hda: SAMSUNG SP1203N, ATA DISK drive ← 得知硬盘装置为 hda
hdd: NU CD-RW/DVD-ROM DBW-521, ATAPI CD/DVD-ROM drive
hda: attached ide-disk driver.
hda: host protected area => 1
hda: 234493056 sectors (120060 MB) w/2048KiB Cache, CHS=14596/255/63
hda: unknown partition table
hdd: attached ide-scsi driver.
root@6[~]# dd if=/dev/zero of=/dev/hda bs=512 count=1 ← 清除 partition table
读入了 1+0 个区段
输出了 1+0 个区段
512 bytes transferred in 0.012975 seconds (39460 bytes/sec)
root@6[~]# fdisk /dev/hda ← 分割硬盘
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 14596.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n ← 建立新分割区
Command action
e extended
p primary partition (1-4)
p ← 建立主要分割
Partition number (1-4): 1
First cylinder (1-14596, default 1): ← 按 [Enter] 使用预设
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-14596, default 14596): +365M ← 系统分割区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (46-14596, default 46): ← 按 [Enter] 使用预设
Using default value 46
Last cylinder or +size or +sizeM or +sizeK (46-14596, default 14596): +512M ← swap
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (109-14596, default 109): ← 按 [Enter] 使用预设
Using default value 109
Last cylinder or +size or +sizeM or +sizeK (109-14596, default 14596): ← 按 [Enter] 使用预设
Using default value 14596
Command (m for help): t ← 更改文件系统
Partition number (1-4): 2 ← 更改第 2 个分割区
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap)
Command (m for help): p
Disk /dev/hda: 120.0 GB, 120060444672 bytes
255 heads, 63 sectors/track, 14596 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 45 361431 83 Linux
/dev/hda2 46 108 506047+ 82 Linux swap
/dev/hda3 109 14596 116374860 83 Linux
Command (m for help): w ← 写入 MBR
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@6[~]# mke2fs -j /dev/hda1 ← 格式化
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
90360 inodes, 361428 blocks
18071 blocks (5.00%) reserved for the super user
First data block=1
45 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root@6[~]# mke2fs -j /dev/hda3 ← 格式化
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
14548992 inodes, 29093715 blocks
1454685 blocks (5.00%) reserved for the super user
First data block=0
888 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root@6[~]# mkswap /dev/hda2 ← 格式化
Setting up swapspace version 1, size = 518184 kB
root@6[~]# mount -t ext3 /dev/hda1 /mnt/hda1 ← 挂载第 1 个分割区
root@6[~]# cd /mnt/hda1
[email=root@6[hda1]root@6[hda1[/email]]# wget
http://www.linkstationwiki.org/downloads/stock_firmware/HD-HLAN_FW2.05.zip ← 下载原厂固件
[email=root@6[hda1]root@6[hda1[/email]]# unzip HD-HLAN_FW2.05.zip
[email=root@6[hda1]root@6[hda1[/email]]# cd HD-HLAN_FW2.05
[email=root@6[HD-HLAN_FW2.05]root@6[HD-HLAN_FW2.05[/email]]# unzip image.dat
[image.dat] tmpimage.tgz password:1NIf_2yUOlRDpYZUVNqboRpMBoZwT4PzoUvOPUp6l ← 输入密码
Archive: image.dat
inflating: tmpimage.tgz
[email=root@6[HD-HLAN_FW2.05]root@6[HD-HLAN_FW2.05[/email]]# mv tmpimage.tgz ../
[email=root@6[HD-HLAN_FW2.05]root@6[HD-HLAN_FW2.05[/email]]# cd ..
[email=root@6[hda1]root@6[hda1[/email]]# tar zxvf tmpimage.tgz
[email=root@6[hda1]root@6[hda1[/email]]# wget
http://www.geishuettner.de/docs/Linkstation/debil-0.1.tgz
[email=root@6[hda1]root@6[hda1[/email]]# rm -rf HD-HLAN_FW2.05 HD-HLAN_FW2.05.zip
[email=root@6[hda1]root@6[hda1[/email]]# cd
root@6[~]# umount /mnt/hda
root@6[~]# cd /var/tmp
[email=root@6[tmp]root@6[tmp[/email]]# wget
http://www.geishuettner.de/docs/Linkstation/files.zip
[email=root@6[tmp]root@6[tmp[/email]]# unzip files.zip
[email=root@6[tmp]root@6[tmp[/email]]# chmod 755 fix_ext2_magic_back
[email=root@6[tmp]root@6[tmp[/email]]# ./fix_ext2_magic_back --fix /dev/hda1 ← 更改 MBR 信息, 否则 LinkStation 无法开机
Block group 0: magic number = 0xef53 -> 0xef54 (fixed)
Block group 1: magic number = 0xef53 -> 0xef54 (fixed)
Block group 3: magic number = 0xef53 -> 0xef54 (fixed)
Block group 5: magic number = 0xef53 -> 0xef54 (fixed)
Block group 7: magic number = 0xef53 -> 0xef54 (fixed)
Block group 9: magic number = 0xef53 -> 0xef54 (fixed)
Block group 25: magic number = 0xef53 -> 0xef54 (fixed)
Block group 27: magic number = 0xef53 -> 0xef54 (fixed)