I have recently obtained a WD Elements 2TB drive but unlike the OP I have an HDR not an HD. I decided to try formatting in on-the-box using the new maintenance mode in the latest version of custom firmware (1.15). When first connected, I noticed that it was already formatted with NTFS and had been mounted by the ntfs-3g package. I could have continued to use it as is but in the spirit of adventure I decided to trash the partition and format to EXT3. The following procedure gives the basic commands to partition and format a disk, it may be wrapped up in a script in future. Note that this proecdure is good for disks up to 2TB.
Maintenance mode stops the humaxtv application from running in order to free up memory for the disk format (or checking) application. When entering maintenance mode you should be aware that the picture will freeze and the box will appear to lock up, only telnet will still be available. Make sure there are no active recordings or programmes scheduled to start while you are in maintenance mode. It takes roughly 20-30 minutes to format a 2TB disk. To enter maintenance mode type the following at the telnet prompt:
Code:
touch /var/lib/humaxtv/mod/maintenance.boot
reboot
The telnet session will then be closed and the box will reboot. After a few seconds you should be able to telnet back into the box but the picture will be frozen etc.
Disk are shown as /dev/sda, /dev/sdb,... Partitions on those disks are /dev/sda1, /dev/sda2 etc. On the HDR, disks are labelled according to the order that they are found on boot. Any attached USB disks are seen first followed by the internal disk. This means that if no external disk is attached the internal disk will be /dev/sda and then any new disk attached will become /dev/sdb, /dev/sdc etc. If however the box is booted with a disk already connected that USB disk will become /dev/sda and then the internal disk will be seen as /dev/sdb. The best thing is to always check the disk order after a reboot or connecting a new disk.
Type 'fdisk -lu' to see a list of disks and their partitions; it should produce something similar to this:
Code:
fdisk -lu
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2048 3907024895 1953511424 7 HPFS/NTFS
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 2 2104514 1052256+ 83 Linux
/dev/sdb2 2104515 955787174 476841330 83 Linux
/dev/sdb3 955787175 976768064 10490445 83 Linux
Here the new disk is /dev/sda which has been preformatted with an NTFS partition /dev/sda1. It was connected before booting into maintenance mode. If the disk had not been preformatted, the partition /dev/sda1 would not be shown but the disk /dev/sda would still be in the above listing.
If, as above the disk has been preformatted then the operating system may have mounted it. To check type 'df -h'.
Code:
df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 16.2M 16.2M 0 100% /
tmpfs 61.0M 36.0K 61.0M 0% /tmp
tmpfs 61.0M 0 61.0M 0% /media
/dev/mtdblock1 2.0M 532.0K 1.5M 26% /var/lib/humaxtv
/dev/mtdblock2 2.0M 1.2M 772.0K 62% /var/lib/humaxtv_backup
/dev/mtdblock2 2.0M 1.2M 772.0K 62% /usr/browser/config-ocontroller-si-rootfs.txt
/dev/sda1 1.8T 0G 1.8T 0% /media/drive1
/dev/sdb1 1011.4M 38.7M 921.4M 4% /mnt/hd1
/dev/sdb2 447.6G 422.0G 2.9G 99% /mnt/hd2
/dev/sdb3 9.8G 1.0G 8.3G 11% /mnt/hd3
If it is present in the above listing unmount all of its partitions using 'umount <Filesystem>' e.g. in the case:
Partitioning the disk
The drive can now be partitioned using the fdisk command. It is very important to make sure you are using the correct disk to avoid the loss of any data. The fdisk command has an interactive mode which takes simple one letter commands. Type 'fdisk -u /dev/sda' if partitioning the /dev/sda disk, then p to print the partition table, this should show the same info as above. Ignore the initial warning about the number of cylinders when first starting fdisk. If you mess up at any stage type 'q' or Ctrl-C to quit without saving any changes. The fdisk command only makes changes to the partition table when the 'w' command is used to exit normally.
Code:
fdisk -u /dev/sda
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 the previous content
won't be recoverable.
The number of cylinders for this disk is set to 243201.
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)
Command (m for help): p
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2048 3907024895 1953511424 7 HPFS/NTFS
At this point there are two options
- Relabel the partition as Linux and reuse it or,
- Delete the partition and make a new one.
Both options will require the partitions to be (re)formatted afterwards.
If option 1 then the system ID has to be changed from 7 to 83 using the 't' command:
Code:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Changed system type of partition 1 to 83 (Linux)
Command (m for help): p
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2048 3907024895 1953511424 83 Linux
Type 'w' to save the partition table and exit from fdisk or type 'q' to quit without saving any changes. Then proceed to 'Formatting the partition' below.
If instead we are using option 2 above where it has been decided to delete the partition and create a new one, the partition is first deleted using the 'd' conmmand.
Code:
Command (m for help): p
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 243202 1953511424 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help):
A new primary partition is created using the 'n' command. I recommend setting the start sector to 2048 since that should ensure proper alignment with some disks (including the WD). Just accept the default last sector value (by pressing return) if you are only creating one big partition.
Code:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-3907024895, default 63): 2048
Last sector or +size or +sizeM or +sizeK (2048-3907024895, default 3907024895): Using default value 3907024895
Command (m for help): p
Disk /dev/sda: 2000.3 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024896 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2048 3907024895 1953511424 83 Linux
Next type 'w' to write the new partition or 'q' to quit without saving.
Code:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table
Formatting the partition
Now that the partition table has been modified we can format the partition with an ext3 filesystem:
Here we use the partition (/dev/sda1) not the disk (/dev/sda) as an argument to the mkfs.ext3 command: e.g.
Code:
mkfs.ext3 /dev/sda1
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
122101760 inodes, 488377856 blocks
24418892 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
14905 block groups
32768 blocks per group, 32768 fragments per group
8192 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
Writing inode tables: 63/14905
This last operation will take about 20 minutes for a 2TB disk. After this is finished type 'reboot' to exit maintenance mode and resume normal operation. The Humax UI should now see the new disk.