TWI796631B - Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same - Google Patents
Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same Download PDFInfo
- Publication number
- TWI796631B TWI796631B TW110103813A TW110103813A TWI796631B TW I796631 B TWI796631 B TW I796631B TW 110103813 A TW110103813 A TW 110103813A TW 110103813 A TW110103813 A TW 110103813A TW I796631 B TWI796631 B TW I796631B
- Authority
- TW
- Taiwan
- Prior art keywords
- external storage
- storage device
- formatted
- hard disk
- automatically
- Prior art date
Links
Images
Landscapes
- Electrophonic Musical Instruments (AREA)
- Exchange Systems With Centralized Control (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
Description
本揭露是有關於一種外接式儲存裝置之控制方法及應用其之電子裝置,且特別是有關於一種在Linux系統實現外接式儲存裝置之隨插即用功能的方法及應用其之電子裝置。 The present disclosure relates to a method for controlling an external storage device and an electronic device using the same, and in particular to a method for realizing the plug-and-play function of an external storage device in a Linux system and an electronic device using the same.
隨著科技的發展,各式電子裝置不斷堆陳出新。在電子裝置中,部分的電子裝置可以安裝Linux系統。Linux系統可以安裝於嵌入式裝置、個人電腦或超級電腦(Super Computer)上。 With the development of science and technology, various electronic devices continue to pile up new ones. Among the electronic devices, a Linux system can be installed on some of the electronic devices. The Linux system can be installed on an embedded device, a personal computer or a super computer (Super Computer).
對進行電子裝置的測試或其他程序時,經常需要插入外接式儲存裝置來儲存測試報告或其他資料。然而,外接式儲存裝置插入採用Linux系統的電子裝置時,必須透過專業人士對電子裝置下達大量Shell script指令,才能夠對外接式儲存裝置進行初始化,而無法隨插即用,這對一般使用者而言相當不便。 When performing tests or other procedures on electronic devices, it is often necessary to insert an external storage device to store test reports or other data. However, when an external storage device is plugged into an electronic device using a Linux system, a large number of Shell script commands must be issued to the electronic device by a professional to initialize the external storage device, and plug-and-play is not possible. quite inconvenient.
本揭露係有關於一種在Linux系統實現外接式儲存裝置之隨插即用功能的方法及應用其之電子裝置,其對外接式儲存裝置進行分類偵測,並自動進行對應的格式化與掛載程序,使得外接式儲存裝置能夠在Linux系統下實現隨插即用的功能。 This disclosure is about a method for realizing the plug-and-play function of an external storage device in a Linux system and an electronic device using the same, which classifies and detects external storage devices, and automatically performs corresponding formatting and mounting The program enables the external storage device to realize the plug-and-play function under the Linux system.
根據本揭露之第一方面,提出一種在Linux系統實現外接式儲存裝置之隨插即用功能的方法。在Linux系統實現外接式儲存裝置之隨插即用功能的方法包括以下步驟。偵測插入一電子裝置之一外接式儲存裝置是否為一機械硬碟(HDD)或一固態硬碟(SSD)。電子裝置安裝Linux系統。偵測外接式儲存裝置是否已格式化。若外接式儲存裝置為機械硬碟或固態硬碟,且外接式儲存裝置尚未格式化,則以NTFS檔案系統對外接式儲存裝置自動進行格式化。在外接式儲存裝置已格式化後,自動掛載(mount)外接式儲存裝置。 According to the first aspect of the present disclosure, a method for realizing the plug-and-play function of an external storage device in a Linux system is proposed. The method for implementing the plug-and-play function of an external storage device in a Linux system includes the following steps. Detect whether an external storage device inserted into an electronic device is a mechanical hard disk (HDD) or a solid state disk (SSD). The electronic device is installed with a Linux system. Detect whether the external storage device has been formatted. If the external storage device is a mechanical hard disk or solid state drive, and the external storage device has not been formatted, the external storage device will be automatically formatted with the NTFS file system. After the external storage device is formatted, automatically mount the external storage device.
根據本揭露之第二方面,提出一種安裝Linux系統之電子裝置。電子裝置包括一偵測單元、一格式化單元及一掛載單元。偵測單元用以偵測插入電子裝置之一外接式儲存裝置是否為一機械硬碟(HDD)或一固態硬碟(SSD),並偵測外接式儲存裝置是否已格式化。若外接式儲存裝置為機械硬碟或固態硬碟,且外接式儲存裝置尚未格式化,則以NTFS檔案系統對外接式儲存裝置自動進行格式化。掛載單元用以在外接式儲存裝置已格式化後,自動掛載(mount)外接式儲存裝置。 According to the second aspect of the present disclosure, an electronic device installed with a Linux system is provided. The electronic device includes a detection unit, a formatting unit and a mounting unit. The detecting unit is used for detecting whether the external storage device inserted into the electronic device is a mechanical hard disk (HDD) or a solid state disk (SSD), and whether the external storage device has been formatted. If the external storage device is a mechanical hard disk or solid state drive, and the external storage device has not been formatted, the external storage device will be automatically formatted with the NTFS file system. The mounting unit is used for automatically mounting (mount) the external storage device after the external storage device is formatted.
為了對本揭露之上述及其他方面有更佳的瞭解,下文特舉實施例,並配合所附圖式詳細說明如下: In order to have a better understanding of the above and other aspects of the present disclosure, the following specific embodiments are described in detail in conjunction with the attached drawings as follows:
100,200:電子裝置 100,200: electronic devices
110:偵測單元 110: Detection unit
120:格式化單元 120: format unit
130:掛載單元 130: Mounting unit
240:測試單元 240:Test unit
250:讀寫單元 250: read and write unit
260:電量量測單元 260: power measurement unit
270:警示單元 270: warning unit
800,900:外接式儲存裝置 800,900: external storage device
RP:測試報告 RP: Test report
S110,S120,S130,S140,S141,S142,S150,S151,S152,S160,S161,S162,S170,S171,S172,S243~S249,S253~S259,S263~S269,S273~S279:步驟 S110, S120, S130, S140, S141, S142, S150, S151, S152, S160, S161, S162, S170, S171, S172, S243~S249, S253~S259, S263~S269, S273~S279: steps
第1圖繪示根據一實施例之電子裝置及外接式儲存裝置之示意圖。 FIG. 1 shows a schematic diagram of an electronic device and an external storage device according to an embodiment.
第2圖繪示根據一實施例之電子裝置之方塊圖。 FIG. 2 shows a block diagram of an electronic device according to an embodiment.
第3圖繪示根據一實施例之實現隨插即用功能之外接式儲存裝置的控制方法的流程圖。 FIG. 3 is a flow chart of a method for controlling an external storage device implementing a plug-and-play function according to an embodiment.
第4圖繪示根據另一實施例之電子裝置之方塊圖。 FIG. 4 shows a block diagram of an electronic device according to another embodiment.
第5A~5E圖繪示根據另一實施例之實現隨插即用功能及自動儲存測試報告之外接式儲存裝置的控制方法的流程圖。 FIGS. 5A-5E are flow charts illustrating a control method of an external storage device for realizing the plug-and-play function and automatically storing test reports according to another embodiment.
請參照第1圖,其繪示根據一實施例之電子裝置100及外接式儲存裝置800之示意圖。電子裝置100例如是一筆記型電腦、一桌上型電腦、一平板電腦或一行動電話。外接式儲存裝置800例如是一機械硬碟(HDD)、一固態硬碟(SSD)、一隨身碟或一記憶卡。
Please refer to FIG. 1 , which shows a schematic diagram of an
電子裝置100已安裝Linux系統。通常外接式儲存裝置800必須已經進行格式化才能提供給電子裝置100使用。外接式儲存裝置800可以透過複雜的Shell script指令來進行格式化,但這對使用者
而言並不方便。尤其是外接式儲存裝置800種類繁多,面對不同種類的外接式儲存裝置800,還需要不同的Shell script指令來進行格式化,這對一般使用者而言實在難以完成。本揭露透過偵測與自動化程序,讓各種外接式儲存裝置800皆能夠在Linux系統上自動完成初始化程序,而能夠實現隨插即用功能,方便一般使用者使用。
The
請參照第2圖,其繪示根據一實施例之電子裝置100之方塊圖。電子裝置100包括一偵測單元110、一格式化單元120及一掛載單元130。偵測單元110、格式化單元120及掛載單元130例如是一軟體程式碼、一晶片、一電路、一電路板或儲存軟體程式碼之儲存裝置。偵測單元110可以對外接式儲存裝置800進行偵測。在取得外接式儲存裝置800的各項資訊後,利用格式化單元120對外接式儲存裝置800自動進行格式化。並且,利用掛載單元130對外接式儲存裝置800自動進行掛載(mount)。如此一來,使用者無需輸入複雜的Shell script指令,即可順利初始化外接式儲存裝置800,而實現隨插即用功能。以下更透過一流程圖詳細說明各項元件之運作。
Please refer to FIG. 2 , which shows a block diagram of an
請參照第3圖,其繪示根據一實施例之實現隨插即用功能之外接式儲存裝置800的控制方法的流程圖。在步驟S110中,偵測單元110偵測插入電子裝置100之外接式儲存裝置800是否為一機械硬碟或一固態硬碟。若外接式儲存裝置800為機械硬碟或固態硬碟,則進入步驟S120;若外接式儲存裝置800不是機械硬碟或固態硬碟,則進入步驟S130。
Please refer to FIG. 3 , which shows a flow chart of a control method of the
在步驟S120中,偵測單元110偵測插入電子裝置100之外接式儲存裝置800為機械硬碟還是固態硬碟。若外接式儲存裝置800為機械硬碟,則進入步驟S140;若外接式儲存裝置800為固態硬碟,則進入步驟S150。
In step S120 , the
在步驟S130中,偵測單元110偵測插入電子裝置100之外接式儲存裝置800之容量是否大於4GB。若外接式儲存裝置800之容量大於4GB,則進入步驟S160;若外接式儲存裝置800之容量不大於4GB,則進入步驟S170。
In step S130 , the
根據步驟S110~S130的判斷,已將外接式儲存裝置800分類為「機械硬碟」、「固態硬碟」、「大於4GB之其他儲存裝置」、「不大於4GB之其他儲存裝置」。
According to the judgment of steps S110-S130, the
歸類為這四種類別後,分別在步驟S140、S150、S160、S170以偵測單元110偵測外接式儲存裝置800是否已格式化。若外接式儲存裝置800未格式化,則分別進入步驟S141、S151、S161、S171;若外接式儲存裝置800已格式化,則分別進入步驟S142、S152、S162、S172。
After being classified into these four categories, the
在步驟S141中,格式化單元120以NTFS檔案系統對「機械硬碟」之外接式儲存裝置800自動進行格式化。
In step S141, the
在步驟S151中,格式化單元120以NTFS檔案系統對「固態硬碟」之外接式儲存裝置800自動進行格式化。
In step S151 , the
在步驟S161中,格式化單元120以FAT32檔案系統對「大於4GB之其他儲存裝置」之外接式儲存裝置800自動進
行格式化。
In step S161, the
在步驟S171中,格式化單元120以exFAT檔案系統對「不大於4GB之其他儲存裝置」之外接式儲存裝置800自動進行格式化。
In step S171, the
接著,在步驟S142、S152、S162、S172,掛載單元130自動掛載外接式儲存裝置800。
Next, in steps S142 , S152 , S162 , and S172 , the mounting
根據上述實施例,偵測單元110能夠自動偵測出外接式儲存裝置800屬於「機械硬碟」、「固態硬碟」、「大於4GB之其他儲存裝置」、「不大於4GB之其他儲存裝置」之4種分類,並透過格式化單元120以適當的檔案系統進行格式化,且透過掛載單元130自動進行掛載。如此一來,一旦外接式儲存裝置800插入電子裝置100,電子裝置100即可自動地對外接式儲存裝置800進行初始化,讓外接式儲存裝置800能夠在Linux系統下實現隨插即用功能。
According to the above embodiment, the
實現了外接式儲存裝置800在安裝Linux系統下的隨插即用功能之後,更可以進一步實現自動儲存測試報告的功能。請參照第4圖,其繪示根據另一實施例之電子裝置200之方塊圖。電子裝置200包括一偵測單元110、一格式化單元120、一掛載單元130、一測試單元240、一讀寫單元250、一電量量測單元260及一警示單元270。測試單元240、讀寫單元250、電量量測單元260及警示單元270例如是一軟體程式碼、一晶片、一電路、一電路板或儲存軟體程式碼之儲存裝置。外接式儲存裝置900插
入電子裝置200後,電子裝置200即可自動地對外接式儲存裝置900進行初始化。接著,測試單元240依據儲存於電子裝置200的腳本自動執行一測試程序。在測試程序執行完畢後,讀寫單元250可以自動儲存一測試報告RP至外接式儲存裝置900,而實現自動儲存測試報告的功能。以下更透過一流程圖詳細說明各項元件之運作。
After the plug-and-play function of the
請參照第5A~5E圖,其繪示根據另一實施例之實現隨插即用功能及自動儲存測試報告之外接式儲存裝置900的控制方法的流程圖。步驟S110、S120、S130、S140、S150、S160、S170、S141、S142、S151、S152、S161、S162、S171、S172描述的是前述之隨插即用功能,同前所述,在此不再重述。 Please refer to FIGS. 5A-5E , which illustrate a flowchart of a control method of the external storage device 900 for implementing the plug-and-play function and automatically storing test reports according to another embodiment. Steps S110, S120, S130, S140, S150, S160, S170, S141, S142, S151, S152, S161, S162, S171, and S172 describe the aforementioned plug-and-play functions, which are the same as those described above and are not repeated here. restate.
在自動完成外接式儲存裝置900之初始化後,分別進入步驟S243、S253、S263、S273。 After the initialization of the external storage device 900 is automatically completed, step S243 , S253 , S263 , and S273 are respectively entered.
在步驟S243、S253、S263、S273中,測試單元240對電子裝置200自動執行測試程序。測試程序例如是進行電子裝置200之通訊功能測試或顯示功能測試。
In steps S243 , S253 , S263 , and S273 , the
接著,在步驟S244、S254、S264、S274中,電量量測單元260判斷電子裝置200之電量低於一預定準位(例如是5%或10%)。若電子裝置200之電量低於預定準位,則分別進入步驟S246、S256、S266、S276;若電子裝置200之電量不低於預定準位,則分別進入步驟S245、S255、S265、S275。
Next, in steps S244 , S254 , S264 , and S274 , the
在步驟S245、S255、S265、S275中,測試單元
240判斷電子裝置200是否完成測試程序。若電子裝置200已完成測試程序,則進入步驟S246、S256、S266、S276;若電子裝置200未完成測試程序,則回至步驟S243、S253、S263、S273。
In steps S245, S255, S265, S275, the
在步驟S246中,讀寫單元250以一第一速度對「機械硬碟」之外接式儲存裝置900進行讀寫,以自動儲存測試報告RP至外接式儲存裝置900。
In step S246 , the read-
在步驟S256中,讀寫單元250以一第二速度對「固態硬碟」之外接式儲存裝置900進行讀寫,以自動儲存測試報告RP至外接式儲存裝置900。第二速度高於第一速度。
In step S256 , the read-
在步驟S266、S276中,讀寫單元250以一第三速度對「大於4GB之其他儲存裝置」、「不大於4GB之其他儲存裝置」之外接式儲存裝置900進行讀寫,以自動儲存測試報告RP至外接式儲存裝置900。第三速度高於第一速度。
In steps S266 and S276, the read-
接著,在步驟S247、S257、S267、S277中,讀寫單元250判斷測試報告RP是否已儲存完畢。若測試報告RP已儲存完畢,則結束本流程;若測試報告RP尚未儲存完畢,則進入步驟S248、S258、S268、S278。
Next, in steps S247 , S257 , S267 , and S277 , the read-
在步驟S248、S258、S268、S278中,讀寫單元250判斷外接式儲存裝置900之剩餘空間是否足夠。若外接式儲存裝置900之剩餘空間足夠,則回至步驟S246、S256、S266、S276;若外接式儲存裝置900之剩餘空間不足,則進入步驟S249、S259、S269、S279。
In steps S248 , S258 , S268 , and S278 , the read-
在步驟S249、S259、S269、S279中,警示單元270發出一警示訊息,以通知操作人員更換外接式儲存裝置900。 In steps S249 , S259 , S269 , and S279 , the warning unit 270 sends out a warning message to notify the operator to replace the external storage device 900 .
根據上述實施例,測試單元240能夠自動對電子裝置200自動執行測試程序,並透過讀寫單元250自動儲存測試報告RP。如此一來,讓安裝Linux系統的電子裝置200能夠實現自動儲存測試報告的功能。
According to the above-mentioned embodiment, the
綜上所述,雖然本揭露已以實施例揭露如上,然其並非用以限定本揭露。本揭露所屬技術領域中具有通常知識者,在不脫離本揭露之精神和範圍內,當可作各種之更動與潤飾。因此,本揭露之保護範圍當視後附之申請專利範圍所界定者為準。 To sum up, although the present disclosure has been disclosed above with embodiments, it is not intended to limit the present disclosure. Those with ordinary knowledge in the technical field to which this disclosure belongs may make various changes and modifications without departing from the spirit and scope of this disclosure. Therefore, the scope of protection of this disclosure should be defined by the scope of the appended patent application.
S110,S120,S130,S140,S141,S142,S150,S151,S152,S160,S161,S162,S170,S171,S172:步驟 S110, S120, S130, S140, S141, S142, S150, S151, S152, S160, S161, S162, S170, S171, S172: steps
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110103813A TWI796631B (en) | 2021-02-02 | 2021-02-02 | Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110103813A TWI796631B (en) | 2021-02-02 | 2021-02-02 | Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202232311A TW202232311A (en) | 2022-08-16 |
TWI796631B true TWI796631B (en) | 2023-03-21 |
Family
ID=83782633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW110103813A TWI796631B (en) | 2021-02-02 | 2021-02-02 | Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI796631B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201020762A (en) * | 2008-11-21 | 2010-06-01 | Inventec Corp | Testing method for dynamic generating boot shell |
TW201413586A (en) * | 2012-09-28 | 2014-04-01 | Innostor Technology Corp | Multifunction storage device for booting |
TW201445324A (en) * | 2013-05-31 | 2014-12-01 | Phind Corp | Connecting and accessing method for remote hard drive, and non-transitory computer readable medium for using the same |
CN106502657A (en) * | 2016-10-11 | 2017-03-15 | 郑州云海信息技术有限公司 | A kind of method for realizing that based on linux automatizatioies HBA cards hard disk configures RAID |
CN108279933A (en) * | 2018-01-25 | 2018-07-13 | 郑州云海信息技术有限公司 | A kind of method of automatic carry USB flash disk under Linux system |
CN111722879A (en) * | 2020-06-19 | 2020-09-29 | 浪潮电子信息产业股份有限公司 | USB flash disk identification method, Linux system, Linux equipment and readable storage medium |
CN112231761A (en) * | 2020-12-14 | 2021-01-15 | 统信软件技术有限公司 | Device mounting method, computing device and readable storage medium |
-
2021
- 2021-02-02 TW TW110103813A patent/TWI796631B/en active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201020762A (en) * | 2008-11-21 | 2010-06-01 | Inventec Corp | Testing method for dynamic generating boot shell |
TW201413586A (en) * | 2012-09-28 | 2014-04-01 | Innostor Technology Corp | Multifunction storage device for booting |
TW201445324A (en) * | 2013-05-31 | 2014-12-01 | Phind Corp | Connecting and accessing method for remote hard drive, and non-transitory computer readable medium for using the same |
CN106502657A (en) * | 2016-10-11 | 2017-03-15 | 郑州云海信息技术有限公司 | A kind of method for realizing that based on linux automatizatioies HBA cards hard disk configures RAID |
CN108279933A (en) * | 2018-01-25 | 2018-07-13 | 郑州云海信息技术有限公司 | A kind of method of automatic carry USB flash disk under Linux system |
CN111722879A (en) * | 2020-06-19 | 2020-09-29 | 浪潮电子信息产业股份有限公司 | USB flash disk identification method, Linux system, Linux equipment and readable storage medium |
CN112231761A (en) * | 2020-12-14 | 2021-01-15 | 统信软件技术有限公司 | Device mounting method, computing device and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
TW202232311A (en) | 2022-08-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI479309B (en) | Apparatus and method for controlling a solid state disk | |
CN102568522B (en) | The method of testing of hard disk performance and device | |
US20240264915A1 (en) | Data storage method and apparatus, and electronic device and readable storage medium | |
CN103942009A (en) | Apparatus and method for extending memory in terminal | |
CN114153779A (en) | I2C communication method, system, equipment and storage medium | |
CN104133750A (en) | Method and system for testing compatibility adaptability of host and storage device | |
US20040236804A1 (en) | Monitoring and data exchange procedure for a peripheral data storage unit | |
US20110022901A1 (en) | Method for testing hard disks under an extensible firmware interface | |
TWI796631B (en) | Method for realizing plug-and-play function of external storage device in linux system and electronic device using the same | |
CN114155906A (en) | Data block repairing method, device, equipment and storage medium | |
US9153345B2 (en) | Error generating apparatus for solid state drive tester | |
US20120005441A1 (en) | Copying apparatus, copying method, memory medium, and program | |
CN104199621A (en) | Hard disk management system | |
CN116627737A (en) | Hard disk testing method, device, equipment and medium | |
CN111142787A (en) | Storage-layered data exchange testing method, system, terminal and storage medium | |
US9990382B1 (en) | Secure erasure and repair of non-mechanical storage media | |
TWI791966B (en) | Data processing method and memory controller utilizing the same | |
CN106909484B (en) | System and method for simulating bad disk test in storage environment | |
CN102750234B (en) | The control method of memorizer and controller | |
CN111367710A (en) | eMMC problem reduction method and device | |
US6892274B2 (en) | Method and apparatus for handling data transfers | |
CN103064803B (en) | A kind of data read-write method of NAND Flash storage device and device | |
KR100925523B1 (en) | Method Of Generating Error In Storage Device And Method Of Selecting Error Generating Location In Storage Device | |
TWI633434B (en) | Method, system, and computer readable medium for managing solid state drive | |
EP3557422A1 (en) | Method for accessing code sram, and electronic device |