Àç½ÃÀÛPython LibParted ¹ÙÀεù | |
Áö±Ý ´Ù¿î·Îµå |
Àç½ÃÀÛ ¼øÀ§ ¹× ¿ä¾à
±¤°í
Àç½ÃÀÛ Å±×
Àç½ÃÀÛ ¼³¸í
Reparted´Â Python CTYPES ¸ðµâÀ» ÇнÀÇϱâ À§ÇØ Python CTypes ¸ðµâÀ» ÇнÀÇÕ´Ï´Ù. ±×·¡¼ ÀÚ½ÅÀÇ À§Çè¿¡ óÇÑ´Ù´Â Bindings¸¦ »ç¿ëÇϽʽÿÀ. ÆÄƼ¼ÇÀ» ¸¸µé°í »èÁ¦ÇÏ°í ·¹À̺íÀ» ¼³Á¤ÇÒ ¼öÀÖ´Â ÃæºÐÇÑ ±â´ÉÀ» Á¦°ø ÇؾßÇÏ´Â Àüü ±â´ÉÀÌ ¾ø½À´Ï´Ù. Äڵ带 È®ÀÎÇÏ°í Çâ»óµÈ ±â´ÉÀ» ÁöÀûÇϽʽÿÀ. ±Ã±ÝÇÑ »çÇ×Àº rq.sysadmin@gmail.comÀÔ´Ï´Ù. Àç¹ÌÀÖ°Ô º¸³»½Ê½Ã¿À! ÆÄƼ¼ÇÀ» Ãß°¡Çϱâ À§ÇØ ºü¸¥ ¼Ò°³ : Reparted Import * dev = device.device ( "/ dev / sdb") # ¶Ç´Â ¿øÇÏ´Â Dev°¡ ¹«¾ùÀ̵簣¿¡. # Àμö¾øÀÌ Àüȸ¦ °É¸é ¸ðµç Ç¥ÁØ ÀåÄ¡¿Í ±âº»°ªÀº # ù ¹ø° ÆÄÀÏ findsmydisk = disk.disk (dev) sz = size.size (dev, 200, "mb") new = disk.partition ( myDisk, SZ) # ±âº»°ªÀº ±âº»°ªÀÔ´Ï´Ù.ÀÌ ±âº»°ªÀº ext3 ¹× ÆÄƼ¼Ç À¯Çü "ÀϹÝ"#new = disk.partition (myDisk, sz, fs = "ext4") # ÆÄÀÏ ½Ã½ºÅÛ ºí·ÏÀ» ext4 # new = disk.partition·Î ¼³Á¤ÇÕ´Ï´Ù (myDisk, sz, fs = "ext4", name = "myname") # name # new = disk.partition (myDisk, Sz, Align = 'minimal') # partition Á¤·ÄÀ» minimal.mydisk.add_partition (new) myDisk·Î ¼³Á¤ÇÕ´Ï´Ù. .commit () ÆÄƼ¼Ç ÀνºÅϽº ÀνºÅϽº ÀνºÅϽº ÀνºÅϽº ÀνºÅϽº¿¡¼ ÆÄƼ¼Ç ¼Ó¼º ¹× ¸Þ¼Òµå¿¡ ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. µð½ºÅ© - DiskDeviceÀÇ ÀνºÅϽº¸¦ ¹ÝȯÇÕ´Ï´Ù. DeviceGeomÀÇ ÀνºÅϽº¸¦ ¹ÝȯÇÕ´Ï´Ù.-Tuple (start_sector, end_sector, length_in_sectors) numÀ» ¹Ýº¹ÇÕ´Ï´Ù. ÆÄƼ¼Ç numbertype - ÆÄƼ¼Ç À¯Çü (È®Àå, ÀϹÝ, ³í¸®, etc ...) fs_type - FILESYSTEM ºí·Ï Çü»ó À¯Çü (ext3, ext4, etc ...) name - partition_name -if ÆÄƼ¼Ç Å×À̺íÀºÀÌ ¸Þ¼µå·Î º¯°æÇÒ ¼öÀÖ´Â À̸§À» Áö¿øÇϹǷΠµð½ºÅ© º¯°æ »çÇ×À» Ä¿¹ÔÇؾßÇÕ´Ï´Ù. Set_Flag -set_flag -set radument ( "ºÎÆÃ", "LVM", "boot_legacy"µî) ...)¿Í boolean (true ¶Ç´Â false) ÆÄƼ¼Ç ½ÃÀÛ ¼½ÅÍ¿¡ µû¶ó 'ÃÖ¼Ò'¶Ç´Â 'ÃÖ¼Ò'¶Ç´Â 'ÃÖ¼Ò'¶Ç´Â 'ÃÖ¼Ò'¸¦ ÀüȯÇÕ´Ï´Ù. ±×·¯³ª »õ ÆÄƼ¼Ç¿¡¼ ÃÖ¼ÒÇÑÀÇ Á¤·ÄÀ» ÁöÁ¤ÇÒ ¼ö ÀÖÁö¸¸ ÆÄƼ¼Ç ½ÃÀÛ ¼½ÅÍ°¡ Á¤·ÄµÇµµ·Ï ȸÀüÇÏ´Â °æ¿ì¿¡ µû¶ó ÃÖÀûÀÇ ¸®ÅÏ µÉ ¼ö ÀÖ½À´Ï´Ù. Device : dev = device.device¸¦ Á¦°øÇÏ¿© µð½ºÅ©ÀÇ ÀνºÅϽº¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. ( "/ dev / sdb") # ¶Ç´Â ¿øÇÏ´Â dev°¡ ¹«¾ùÀ̵ç. mydisk = disk.disk (dev) µð½ºÅ© ÀνºÅϽºÀÇ ¼Ó¼º ¹× ¸Þ¼ÒµåÀÔ´Ï´Ù. type_name - µð½ºÅ© ÆÄƼ¼Ç Å×À̺í À̸§ (GPT, DVH, etc ...) type_features - partition_name (À̸§ ÁöÁ¤ ÆÄƼ¼Ç Áö¿ø) ¶Ç´Â È®Àå (LVM) ¹°°Ç, ´ç½ÅÀ»À§ÇÑ ¸í¸í ÆÄƼ¼ÇÀÌ ¾ø½À´Ï´Ù!) block_sizes - µð½ºÅ© ºí·Ï Å©±â°¡µË´Ï´Ù. Needs_Clobber - true ¶Ç´Â false.update_mode - thrue ¶Ç´Â falsePartitions - µð½ºÅ©ÀÇ ÆÄƼ¼Ç ¸ñ·Ï (ÆÄƼ¼Ç ÀνºÅϽº) ¸ñ·ÏÀ» °Ë»öÇÕ´Ï´Ù. ¸ÞŸ µ¥ÀÌÅÍ, ÇÁ¸® ½ºÆäÀ̽º ¹× º¸È£ µÈ ÆÄƼ¼ÇÀº Æ÷ÇԵǾî ÀÖÁö ¾Ê½À´Ï´Ù. DD_Partition - ÆÄƼ¼Ç ÀνºÅϽº¸¦ ¼±ÅÃÇÏ°í µð½ºÅ© ÆÄƼ¼Ç Å×ÀÌºí¿¡ Ãß°¡ÇÕ´Ï´Ù. Âü°í : º¯°æ »çÇ×À» disk.delete_partition¿¡ ÀúÀåÇÏ°í it.delete_all -deletes »èÁ¦¸¦ À§ÇØ º¯°æ »çÇ×À» disk.delete_partition¿¡ ÀúÀåÇÏ°í disk._ped_disk-commits ctypes disk structure._ped_device¸¦ ȸºÎÇÕ´Ï´Ù. ctypes device structure.get_partition - ÆÄƼ¼Ç number.set_labelÀÌ ÁÖ¾îÁø ÆÄƼ¼Ç ÀνºÅϽº´Â ¹®ÀÚ¿ (GPT ¶Ç´Â MSDOS)À» ¼±ÅÃÇÏ°í µð½ºÅ© ÆÄƼ¼Ç Å×À̺íÀ» ¼³Á¤ÇÕ´Ï´Ù. °æ·Î¸¦ Á¦°øÇÏ¿© ÀåÄ¡ÀÇ ÀνºÅϽº¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù (¿¹ : / dev / SDA). Pathis°¡ Á¦°øµÇÁö ¾ÊÀ¸¸é ¸ðµç Ç¥ÁØ ÀåÄ¡°¡ Çϳª¸¦ ãÀ» ¶§±îÁö ¸ðµç Ç¥ÁØ ÀåÄ¡°¡ ÇÁ·ÎºêµË´Ï´Ù. dev = device.device ( "/ dev / sdb") # ¶Ç´Â ¿øÇÏ´Â dev°¡ ¹«¾ùÀ̵簣¿¡. ¶Ç´Â dev = device.device () ÀåÄ¡ ÀνºÅϽºÀÇ ¼Ó¼º ¹× ¸Þ¼ÒµåÀÔ´Ï´Ù. _PED_DEVICE - CTYPES DEVICE ±¸Á¶ .LENGTH - SECTERÀÇ ÀåÄ¡ ±æÀ̸¦ ¹ÝȯÇÕ´Ï´Ù. SECTORS.PATH (Áï, / dev / sda)¸¦ ¹ÝȯÇÕ´Ï´Ù. ¸ðµ¨ - ÀåÄ¡ ¸ðµ¨ (Áï, 'ATA ÇÏµå µð½ºÅ©')À» ¹ÝȯÇÕ´Ï´Ù. À¯Çü - ÀåÄ¡ À¯Çü (Áï, 'scsi'). sector_size - ¼½ÅÍ size.phys_sector_size - ¹°¸®Àû ¼½ÅÍ size.open_Count¸¦ ¹ÝȯÇÕ´Ï´Ù. ÀåÄ¡°¡ ¿·Á ÀÖ½À´Ï´Ù (¼¼¼Ç ´ç) .read_only -true ¶Ç´Â false.External_Mode - thrue ¶Ç´Â false.boot_dirty - thrue ¶Ç´Â false.hw_geom - 3 Æ©Çà (½Ç¸°´õ, Çìµå, ¼½ÅÍ) bios_geom -returns 3 Æ©Çà (½Ç¸°´õ, Çìµå, ¼½ÅÍ) È£½ºÆ® - ÀåÄ¡ È£½ºÆ® ID.DID -ÀÌ°Ô ¹«½¼ ÀÏÀÌ ¾ø´ÂÁö ÀüÇô ¾Ë¸®Áö ¾Ê½À´Ï´Ù. Á¦Ç°ÀÇ È¨ÆäÀÌÁö
Àç½ÃÀÛ °ü·Ã ¼ÒÇÁÆ®¿þ¾î