How rename an Volume (partition) with Objective-C or perl,python, ruby,sh,applescript?

I create vhd in different formats (NTFS, FAT32, FAT16, HFS +), I do not find the way to get the $ Volume_name offset of an NTFS partition, plus I would like to convert a string to $ Volume_name. By observing the $ Volume_name of an NTFS partition I was able to see that the string is cut (after each character there is a null character example what we read in hexadecimal of the volume_name that would be "WIN10EN" and in hexa "57494e3130454e" if we go to the offset of $ volume_name we will read with a hexadecimal editor 570049004e003100300045004e and its representation ascii "W I N 1 0 E N".

Hence my question is there a command to obtain the offset of $ Volume_name (the offset is in byte 15776 or 0x3DA0 on a vhd of 2 giga size) ?

Is there a string conversion to name a Volume?

Thank you for your answers

OS X Yosemite (10.10.5), null

Posted on Nov 30, 2016 5:42 PM

Reply
2 replies

Dec 3, 2016 3:39 PM in response to deek5

Hello everyone, I answer my question. In the creation of a Vhd of course there is the formatting of the partition (my Vhd created have a unique MBR partition) formatting with diskutil according to the chosen system the names of the partitions is limited for NTFS according to diskutil the names are In Capital letter, idem for MSDOS FAT. While long for NTFS or FAT partitions you can use names with small letter. So after formatting for NTFS partitions I use "newfs_ufsd_NTFS -v" to rename with Capital letter, and small letter. For FAT, I changed news_msdos (version 226 https://opensource.apple.com/tarballs/msdosfs/msdosfs-226.tar.gz) the newfs_msdos.c file to line 1320 in "

mklabel (u_int8_t** * dest, Const char * src)
"where we find"
c = * src? Toupper (* src ++): '';"
Changed to "
c = * src? * Src ++: '';
" **which makes it possible to use capital letters or small letters. So for my solution, I do not find an answer to how to get the $Volume_name offset from an NTFS partition.

Dec 19, 2016 7:30 PM in response to deek5

Hello everyone, with Mac Os X one can only format with diskutil, I resigned with applescript to rename the partitions through the information windows and their value of text field 1 of scroll area 1 of window, to make accept with windows or mac os x the lowercase or uppercase letters and spaces. Diskutil sets the partition name to byte 48032 (but coded in UNICODE BIG so 48031 using iconv -f utf-8 -t UNICODEBIG which gives in hex for "Win-10-Fr" 00570069006e002d00310030002d0046007200 therefore 48032 for "W "Or 57 but 0057 in UNICODEBIG from where 48031). The problem to rename does not come essentially from $Volume_name in the MFT but also from its replication in the MFT mirror from where I never could find the calculation of its offset. Following this I simplified the naming of partitions using applescript information window of disk and value of text field 1 of scroll area 1 of window

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How rename an Volume (partition) with Objective-C or perl,python, ruby,sh,applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.