Partitioning and formatting Linux USB flash disks and creating Linux File Systems

Source: Internet
Author: User

It is particularly worth mentioning that there are many things worth learning about Linux USB flash drives. Here we mainly introduce Linux U partition disks, including Linux U formatting disks. I always wanted to use a 256 MB Linux USB flash drive to create a micro-Linux system. However, I did not try it many times. Today I finally made a MB Linux system. I have encountered many problems. Now I will summarize them to facilitate further optimization.

Procedure

I. Linux USB disk partitioning

Because my Linux USB flash drive is only 256 MB, if two partitions are separated, the capacity may be insufficient. Therefore, I would like to divide the Linux USB flash drive into only one partition. Use the fdisk/dev/sdb command to divide the USB flash disk into two partitions: One Ext3 partition and one FAT16 partition, and mark the Linux partition as a bootable partition.

 
 
  1. Disk /dev/sdb: 262 MB, 262012928 bytes  
  2. 1 heads, 56 sectors/track, 9138 cylinders  
  3. Units = cylinders of 56 * 512 = 28672 bytes  
  4. Disk identifier: 0x00000000 
 
 
  1. Device Boot      Start         End      Blocks   Id  System  
  2. /dev/sdb1               2         200        5572    6  FAT16  
  3. /dev/sdb2     *        201        9138      250264   83  Linux 

Note: It seems that the Linux USB flash drive is not stable to separate an ext3 partition? I often go back to FAT16 for no reason.

Ii. Linux USB flash disk formatting

It is worth noting that you must uninstall the Linux USB flash drive before formatting.

Sudo mkfs. vfat/dev/sdb1
Sudo mke2fs-j-m0-l san/dev/sdb2
Sudo tune2fs-c-0-I 0/dev/sdb2

3. Create initRD

The prompt "-- preload = ehci-hcd" is not found during production. I am not sure if there is a problem with this writing method, or should it be "-- preload = ehci_hcd "? Sudo mkinitrd -- preload = ehci-hcd -- preload = usb-storage -- preload = scsi_mod -- preload = sd_mod/boot/usbinitrd. img 'uname-R'

4. Create a Linux File System

Mount the Linux usb flash drive and modify the usb directory permission, create the following chmod 777-R/mnt/usb mkdir bin sbin etc dev lib sys proc usr var root home tmp mnt selinux folder under the Linux usb disk directory.

Then, copy the boot bin sbin etc lib directory in the existing ora10 file system and all the files below it to the Linux USB flash drive (my approach is to manually copy, in this way, the link can be retained. Of course, cp-arp can also be used. My Linux USB flash drive is poor and the Read-Only System problem often occurs, but mount it again!

Note:
1. Later, I tried to manually Mount the file with a text terminal!
2. There is another issue about disk check. During the creation process, the Linux USB flash drive may have an error. In this case, run the e2fsck command to check the corresponding partition, such as e2fsck/dev/sdb2.
3. When creating a file system, you must use UUID to prevent mount misplacement and damage the Linux U disk file system!
4. When the system starts, a line of Log "loading/lib/keymaps/i386/qwerty/us. map" is displayed. This shows that the system dynamic link library file under lib is quite critical!

The following table lists the two-layer directory structure of the file system. Some of the folders are empty. However, after the system starts up, it will create corresponding files, such as/proc, in the directory. It is worth mentioning that my Fedora10 only has a text interface but no graphical interface. Therefore, the file system will be smaller. We recommend that you use a file system without a graphical interface if you want to create a Linux U disk boot disk. This saves a lot of space.

When creating a file system, pay special attention to the configuration of the/etc/fstab file as follows:
Note: For UUID usage issues, see UUID.

 
 
  1. #/dev/sdb1   /   ext3    defaults        1 1  
  2. UUID=bbcbb70a-3da2-47cc-becd-5f3e3a162803    /   ext3    defaults        1 1  
  3. tmpfs                   /dev/shm                tmpfs   defaults        0 0  
  4. devpts                  /dev/pts                devpts  gid=5,mode=620  0 0  
  5. none                    /proc                   proc    defaults        0 0  
 
 
  1. [san@localhost san_fs]$ tree -d -L 2  
  2. |-- bin   
  3. |-- boot  
  4. |   |-- efi  
  5. |   |-- grub  
  6. |   `-- upgrade  
  7. |-- dev   
  8. |-- etc   
  9. |   |-- NetworkManager  
  10. |   |-- X11  
  11. |   |-- alternatives  
  12. |   |-- avahi  
  13. |   |-- blkid  
  14. |   |-- chkconfig.d  
  15. |   |-- cron.daily  
  16. |   |-- dbus-1  
  17. |   |-- default  
  18. |   |-- depmod.d  
  19. |   |-- dirmngr  
  20. |   |-- event.d  
  21. |   |-- fonts  
  22. |   |-- gcrypt  
  23. |   |-- gnupg  
  24. |   |-- init.d -> rc.d/init.d  
  25. |   |-- iproute2  
  26. |   |-- kernel  
  27. |   |-- ld.so.conf.d  
  28. |   |-- logrotate.d  
  29. |   |-- lvm  
  30. |   |-- makedev.d  
  31. |   |-- modprobe.d  
  32. |   |-- netplug  
  33. |   |-- netplug.d  
  34. |   |-- openldap  
  35. |   |-- opt  
  36. |   |-- pam.d  
  37. |   |-- pki  
  38. |   |-- popt.d  
  39. |   |-- ppp  
  40. |   |-- prelink.conf.d  
  41. |   |-- profile.d  
  42. |   |-- rc.d  
  43. |   |-- rc0.d -> rc.d/rc0.d  
  44. |   |-- rc1.d -> rc.d/rc1.d  
  45. |   |-- rc2.d -> rc.d/rc2.d  
  46. |   |-- rc3.d -> rc.d/rc3.d  
  47. |   |-- rc4.d -> rc.d/rc4.d  
  48. |   |-- rc5.d -> rc.d/rc5.d  
  49. |   |-- rc6.d -> rc.d/rc6.d  
  50. |   |-- rpm  
  51. |   |-- rwtab.d  
  52. |   |-- sasl2  
  53. |   |-- security  
  54. |   |-- selinux  
  55. |   |-- skel  
  56. |   |-- statetab.d  
  57. |   |-- sysconfig  
  58. |   |-- terminfo  
  59. |   |-- udev  
  60. |   |-- xdg  
  61. |   |-- xinetd.d  
  62. |   |-- yum  
  63. |   `-- yum.repos.d  
  64. |-- home   
  65. |-- lib   
  66. |   |-- bdevid  
  67. |   |-- dbus-1  
  68. |   |-- firmware  
  69. |   |-- i686  
  70. |   |-- kbd  
  71. |   |-- modules  
  72. |   |-- rtkaio  
  73. |   |-- security  
  74. |   |-- terminfo  
  75. |   |-- tls  
  76. |   |-- udev  
  77. |   `-- xtables  
  78. |-- mnt  
  79. |-- proc  
  80. |-- root  
  81. |-- sbin  
  82. |-- selinux  
  83. |-- sys  
  84. |-- tmp  
  85. |-- usr  
  86. `-- var 

(Lib lock run log and other directories need to be created under this directory, which can be determined according to the prompt after the system is up) 85 directories

  1. Execute export and use man bash in Linux shell System
  2. Start the installation and configuration of Linux Samba server to build
  3. Install and create an account file in Linux Trac
  4. Install and modify the root password service in Linux mysql
  5. Linux vsftpd installation and startup, and logon under the command line, view Chinese file garbled

Related Article

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.