[Libguestfs] Bug: part_set_name does not enquote name

Maxim Perevedentsev mperevedentsev at virtuozzo.com
Wed Dec 9 12:36:08 UTC 2015


Windows server 2012 sets partition names with spaces.

 ><fs> part-get-name /dev/sda 3
libguestfs: trace: part_get_name "/dev/sda" 3
guestfsd: main_loop: new request, len 0x38
parted -s -m /dev/null
Error: The device /dev/null is so small that it cannot possibly store a 
file system or partition table.  Perhaps you selected the wrong device?
Warning: Error fsyncing/closing /dev/null: Invalid argument
parted -m -- /dev/sda unit b print
parted -m -- /dev/sda unit b print
libguestfs: trace: part_get_name = "Basic data storage"
Basic data storage

 ><fs> part-set-name /dev/sda 3 'Basic data storage'
libguestfs: trace: part_set_name "/dev/sda" 3 "Basic data storage"
guestfsd: main_loop: proc 416 (part_get_name) took 0.01 seconds
guestfsd: main_loop: new request, len 0x50
udevadm --debug settle
calling: settle
parted -s -- /dev/sda name 3 Basic data storage
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, 
run in
interactive mode.

OPTIONs:
   -h, --help                      displays this help message
   -l, --list                      lists partition layout on all block 
devices
   -m, --machine                   displays machine parseable output
   -s, --script                    never prompts for user intervention
   -v, --version                   displays the version
   -a, --align=[none|cyl|min|opt]  alignment for new partitions

COMMANDs:
   align-check TYPE N                        check partition N for 
TYPE(min|opt) alignment
   help [COMMAND]                           print general help, or help 
on COMMAND
   mklabel,mktable LABEL-TYPE               create a new disklabel 
(partition table)
   mkpart PART-TYPE [FS-TYPE] START END     make a partition
   name NUMBER NAME                         name partition NUMBER as NAME
   print [devices|free|list,all|NUMBER]     display the partition table, 
available devices, free space, all found partitions, or a particular 
partition
   quit                                     exit program
   rescue START END                         rescue a lost partition near 
START and END
   rm NUMBER                                delete partition NUMBER
   select DEVICE                            choose the device to edit
   disk_set FLAG STATE                      change the FLAG on selected 
device
   disk_toggle [FLAG]                       toggle the state of FLAG on 
selected device
   set NUMBER FLAG STATE                    change the FLAG on partition 
NUMBER
   toggle [NUMBER [FLAG]]                   toggle the state of FLAG on 
partition NUMBER
   unit UNIT                                set the default unit to UNIT
   version                                  display the version number 
and copyright information of GNU Parted

Report bugs to bug-parted at gnu.org
udevadm --debug settle
calling: settle
libguestfs: trace: part_set_name = 0

 ><fs> part-get-name /dev/sda 3
libguestfs: trace: part_get_name "/dev/sda" 3
guestfsd: main_loop: new request, len 0x38
parted -s -m /dev/null
Error: The device /dev/null is so small that it cannot possibly store a 
file system or partition table.  Perhaps you selected the wrong device?
Warning: Error fsyncing/closing /dev/null: Invalid argument
parted -m -- /dev/sda unit b print
parted -m -- /dev/sda unit b print
libguestfs: trace: part_get_name = "Basic"
Basic


-- 
С уважением, Максим Переведенцев
Your sincerely, Maxim Perevedentsev




More information about the Libguestfs mailing list