Commissioning experience-hard drive U-Dish

Source: Internet
Author: User

Commissioning experience-hard drive U-Dish


With the development of embedded device capabilities, with the need for storage devices: a large amount of data information needs to be stored. Need to dump data, USB flash drive upgrade function and so on.
In the process of using storage devices, we encountered a number of problems, but also summed up some experience:

1. Several hard drives often use commands
2, hard drive information analysis
Analysis of reasons for failure of 3,u disk upgrade
4,u disk recognized partition changed to/DEV/SDA


One. Several hard drives often use commands

Hard disk partition: Fdisk/dev/hda (NP1 W)

Format hard drive: mkfs.ext2/dev/hda1

Set UDMA 6 transfer mode: Hdparm-x70/dev/hda

View hard disk information: Smartctl-a/dev/hda

Mount HDD: mount/dev/hda1/mnt/hda1

Fix ext format HDD: e2fsck-y/dev/hda1

View Super Block info: tune2fs-l/dev/hda1

1k data replacement on hard disk: DD if=/dev/hda1 bs=1k skip=131072 count=1 of=/dev/hda1 seek=1

View Super Block Backup location: Mke2fs-n/dev/hda1

View hard disk details (full): dumpe2fs/dev/hda1 |less


Second, hard disk information analysis

Mount the last hard drive, after the system boot recognition, can use FDISK-L to see such as the following information, how to interpret?

disk/dev/hda:500.1 GB, 500107862016 bytes
255 heads, Sectors/track, 60801 cylinders
Units = Cylinders of 16065 * 8225280 bytes

This is actually a 500G Seagate drive with 255 heads, 60,801 cylinders per head, 63 sectors per cylinder, 512 bytes per sector. (CHS)
How to calculate total capacity? For example, the following:
255*60801*63*512 = 500107862016 = 500G


After you format the partition, such as the following method, look at the partition information:
Partition command (divided into only one zone):
Fdisk/dev/hda (D,n,p,1,enter,enter,w,)

Format command (ext2 format):
Mkfs.ext2/dev/hda1

To view the information for a partition using the command:
DUMPE2FS/DEV/HDA1 |less

DUMPE2FS 1.41.11 (14-mar-2010)
Filesystem Volume Name: <none>
Last mounted on: <not available>
Filesystem uuid:fbd1f044-491b-4cda-aaf1-a89c7bdc2726
Filesystem Magic number:0xef53
Filesystem Revision #: 1 (dynamic)
Filesystem Features:filetype Sparse_super
Default mount options: (None)
Filesystem State:not Clean with errors
Errors behavior:continue
Filesystem OS Type:linux
Inode count:61063168
Block count:122096000
Reserved Block count:6104800
Free blocks:120076967
Free inodes:61061072
First block:0
Block size:4096
Fragment size:4096
Blocks per group:32768
Fragments per group:32768
Inodes per group:16384
Inode blocks per group:512
Filesystem Created:thu Jan 1 08:01:35 1970
Last Mount time:wed Dec 1 10:04:11 2010
Last Write Time:thu Jan 1 08:00:35 1970
Mount count:586
Maximum Mount Count:37
Last Checked:thu Jan 1 08:01:35 1970
Check interval:15552000 (6 months)
Next Check After:tue June 30 08:01:35 1970
Reserved blocks uid:0 (user root)
Reserved blocks gid:0 (group root)
First Inode:11
Inode size:128
Default Directory Hash:tea
Directory Hash seed:dea4f717-12bc-4cfb-b26c-50b95411a974


Group 0: (Blocks 0-32767)
Primary superblock at 0, Group descriptors at 1-30
Block bitmap at + (+31), Inode bitmap at 32 (+32)
Inode table at 33-544 (+33)
32210 free blocks, 16365 free inodes, 2 directories
Free blocks:551-4095, 4097-10239, 10241-18431, 18434-22527, 22530-28671, 28673-32767
Free inodes:20-16384

The file magic number marks the file system format, Filesystem Magic number:0xef53, this number represents ext2 or ext3.
Block Size: 4096 bytes
Inode Size: 128 bytes
Each block group has 32,768 blocks.

Backup location of Superblock (in block): 32768xN
The N value is the power of 3,5,7 (n=1,3,5. 7,9. 25,27,49. 81,125,243,343,625,729,2187,2401,3125)

Third, the reason analysis of the failure of U disk upgrade

Reasons to upgrade using a USB flash drive:
The device provides a USB interface. Not used, but only when the data needs to be exported. Because the software always has the need to upgrade, in the usual use of remote network upgrade, provides a way to upgrade a USB stick. USB flash drive Upgrade is not only safe and fast. It makes up for the upgrade problem in the network situation, and relies on fewer execution programs, which can solve some more basic implementation problems.

The process of USB flash drive upgrade:
Plug in the USB stick, restart the device, during the boot process, there is a startup script to check if there is a USB flash drive, and infer whether there is an upgrade file on the USB drive. If you have an upgrade file, start the file update. Once the upgrade is complete, the device restarts again. Formal implementation of the upgraded program.

Encountered some USB flash drive upgrade failure conditions. The probable cause analysis:
1. The USB stick is not recognized.
2, the device name identified by the USB drive does not match the device name in the startup script;
--by adding a supplement to the startup script. Support/DEV/SDA4,/DEV/SDA1,/DEV/SDA to solve some problems.


3. Flash full, cause cannot copy program
-Pre-upgrade. Deleting a few log files can solve some problems.


Once again, a strange phenomenon was encountered:
1. Programs on the device always fail to execute.
2. The USB flash drive is not upgradeable.

Workaround:
1. Viewing error messages
/etc/rcs.d/s03udev:line 52:can ' t create/tmp/uname:no space left on device
This is an error in the system startup script.
2, try to bypass the S03udev.
After the system boots to "freeing init memory", hold down CTRL C until "Login:" appears
3. Enter Root Login
At this point, there is a problem: root cannot login. Error:
Unable to determine your TTY name.
Change the startup configuration of Uboot: Replace NOINITRD with Init=/sbin/init,
able to log in.
4. To view file system space usage, use DF.
The usage rate reached 99%.


Use the command under the root folder: du-d 1. Check to see which folder is too large to clean up.


5, after cleaning out the space, to overcome the problem, can be normal to upgrade the U disk.
6, after many times encountered S03udev error, tracking Error statement. To stare them out. Overwrite the original file at a later time when you upgrade again.


Four, the disk recognition of the partition changed to SDA
Because the first USB flash drive purchased is/DEV/SDA on the device, the upgrade script is also based on whether the device file exists to infer if the USB flash drive has been identified. But in the subsequent purchase of the U disk and other people use the U disk. But most of them are not.

It is found that there are several situations such as the following:
The most is identified as:
One device:/DEV/SDA
One partition:/DEV/SDA1
Another situation is:
One device:/DEV/SDA
One partition:/DEV/SDA4
The third case:
Device and partition coincident:/DEV/SDA

After discovering the problem, we changed the inference of the U-disk test and took the 3 cases into account. But there is a problem, some early equipment to infer that the U disk or rely on/DEV/SDA, and the first USB flash drive is not easy to find, you need to convert other types of USB stick to this situation. After a test. Finally, you can find the method, as follows:

1, under Linux, Fdisk deletes all partitions. Save exit.
2, force format sda:mkfs.vfat/dev/sda-i; then SDA is available.


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Commissioning experience-hard drive U-Dish

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.