macos – Correct procedure to grow an iSCSI partition from an expanded LUN

I’m using the Daemon Tools iSCSI initiator. I have created a practice iSCSI target and LUN on my QNAP. At first, it was 7GB. I took the LUN offline and increased the size to 16GB. I reconnected to the LUN, and I can see the extra space available at the target. However, I cannot seem to expand the partition to absorb the extra space, and even if I add a partition, it only takes from the original 7GB, even as I see the extra space there. Very strange behavior! What is the recommended process to utilize a grown LUN within macOS. I’m 100% OK using diskutil in the shell. Just need some direction. Yes, the original 7GB partition is formatted as HFS+ and GPT.

boot – How to increase the writable partition on a persistent Ubuntu live session

Well, I have created a persistent live session of Ubuntu 20.04 LTS on a 16GB USB stick. I chose to split it in half to also have data storage, but now I want to increase the writable partition of the persistent session. Should I temporarily unmount the writable partition or boot from another live in other to do that and could it affect or cause any problems?

linux – How to change the file system of a partition in a RAID 1?

First, sorry if the question has already been asked and correctly answered, I did not find anything that satisfies me.

I rent a dedicated machine in a datacenter, the machine run with a Debian 10 and has two drives in RAID 1, there are 3 partitions: one for the boot, one for the swap and one for the rest.

The third (/dev/md2) uses the ext4 file system and I would like to use XFS instead.

I am not used to changing the filesystem and this is the first time I have a machine with RAID so I do not know how to do it.

This is a new installation so there is no risk of losing data.

I tried a mkfs.xfs /dev/md2 but it didn’t work:

root@Debian-105-buster-64-minimal ~ # mkfs.xfs /dev/md2
mkfs.xfs: /dev/md2 contains a mounted filesystem

And I don’t know how it should be unmount/mount due to the RAID.

Thank you in advance for the help.

The df -Th command :

root@Debian-105-buster-64-minimal ~ # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs   32G     0   32G   0% /dev
tmpfs          tmpfs     6.3G  516K  6.3G   1% /run
/dev/md2       ext4      437G  1.2G  413G   1% /
tmpfs          tmpfs      32G     0   32G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/md1       ext3      487M   53M  409M  12% /boot
tmpfs          tmpfs     6.3G     0  6.3G   0% /run/user/1000

the fdisk -l command :

root@Debian-105-buster-64-minimal ~ # fdisk -l
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0289e0d1

Device         Boot    Start        End   Sectors   Size Id Type
/dev/nvme0n1p1          2048   67110911  67108864    32G fd Linux raid autodetect
/dev/nvme0n1p2      67110912   68159487   1048576   512M fd Linux raid autodetect
/dev/nvme0n1p3      68159488 1000213167 932053680 444.4G fd Linux raid autodetect


Disk /dev/nvme1n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbcb5c0d2

Device         Boot    Start        End   Sectors   Size Id Type
/dev/nvme1n1p1          2048   67110911  67108864    32G fd Linux raid autodetect
/dev/nvme1n1p2      67110912   68159487   1048576   512M fd Linux raid autodetect
/dev/nvme1n1p3      68159488 1000213167 932053680 444.4G fd Linux raid autodetect


Disk /dev/md1: 511 MiB, 535822336 bytes, 1046528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md0: 32 GiB, 34325135360 bytes, 67041280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md2: 444.3 GiB, 477076193280 bytes, 931789440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

The mdstat :

root@Debian-105-buster-64-minimal ~ # cat /proc/mdstat
Personalities : (raid1) (linear) (multipath) (raid0) (raid6) (raid5) (raid4) (raid10)
md2 : active raid1 nvme0n1p3(0) nvme1n1p3(1)
      465894720 blocks super 1.2 (2/2) (UU)
      bitmap: 0/4 pages (0KB), 65536KB chunk

md0 : active (auto-read-only) raid1 nvme0n1p1(0) nvme1n1p1(1)
      33520640 blocks super 1.2 (2/2) (UU)
        resync=PENDING

md1 : active raid1 nvme0n1p2(0) nvme1n1p2(1)
      523264 blocks super 1.2 (2/2) (UU)

unused devices: <none>

hard drive – How do I move a partition in on macOS?

I’m migrating data from a 525GB drive to a 1TB drive. Part of the reason I’m doing this is the APFS container got messed up on the 525GB drive (I have backups).

The first thing did was dd the data from the 525GB drive to the 1TB drive (partition table and all). Of course, the partition table was wrong (and diskutil verifyDisk reported this) since it was too small for the 1TB drive. I fixed that with diskutil repairDisk.

Then I deleted the APFS container (since it was messed up and I plan to copy the data from a Time Machine backup). The space where the APFS container was is the Untitled partition.

So now the partition table looks like this:

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                           SIZE        IDENTIFIER
   0:      GUID_partition_scheme                               *960.2 GB    disk2
   1:                        EFI EFI                            209.7 MB    disk2s1
   2:                  Apple_HFS Untitled                       314.0 GB    disk2s2
   3:                  Apple_HFS UEFI Boot Manager              1.0 GB      disk2s3
   4:       Microsoft Basic Data BOOTCAMP                       209.6 GB    disk2s4

As you can see, the sizes of the partitions don’t add up to the size of the disk. I’d like to resize disk2s2 to fill the remaining space on my 1TB drive. However, diskutil resizeVolume won’t expand that partition any further because it’s already up against disk2s3 and disk2s4. I’d like to move my disk2s3 and disk2s4 partitions to the end of the drive (right now they’re at the end of the first 525GB of the drive.

How do I move partitions in macOS?

algorithms – Partition a set of factors so that the difference between products is minimized

I’m sure this problem must be well-known…

Given a collection $S$ of numbers, partition them into exactly two sub-collections, $A$ and $B$ (I mean, by definition $B$ is just $S-A$) such that the difference of products
$$
Delta = left|left(prod_{xin B}xright) – left(prod_{xin A}xright)right|
$$

is as small as possible.

If it helps, you can assume that all the members of $S$ are integers, and in fact you can assume that they are all prime! In my particular use-case, we’re trying to split some big integer $n$ into its “squarest possible” pair of factors, and $S$ is simply a prime factorization of $n$ which we happen to have lying around.

What’s the best way to do this? The brutish ways I have thought of are:

  • Trial division (assuming everything is prime). Awful performance.
    int PS = productOf(S);
    for (int PA = sqrt(PS); PA >= 1; --PA) {
        if (PS % PA == 0) {
            int PB = PS / PA;
            return { factorsOf(PA), factorsOf(PB) };
        }
    }
  • Search all the possible partitions. Would give better performance, I think, because $lvert Srvert! ll prod{S}$, but still “obviously” a dumb algorithm.
    int currentDiff = productOf(S);
    intset currentA = {};
    for (intset A in partitionsOf(S)) {
        int PA = productOf(A);
        int PB = productOf(S)/PA;
        if (PB >= PA && PB-PA < currentDiff) {
            currentA = A;
            currentDiff = PB-PA;
        }
    }
    return { currentA, S - currentA };

Is there any simple-ish algorithm to solve this problem without relying on brute exhaustive search?

I wonder if it would work to minimize the difference of sums $sum_{xin B}{log{x}} – sum_{xin A}{log{x}}$, and if that problem has a simpler known solution…

partition – VMware esxi host partedUtil sector bit and block size?

Alright, things i did are: studying https://kb.vmware.com/s/article/1036609 and https://kb.vmware.com/s/article/2004299 , and also googled some other information about the “partedUtil” in ESXi.

I encountered doubts when utilizing partedUtil commandlines to configure partitions in ESXi 7.0 host but I failed to find proper answer for my own doubts.

According to figure below,

enter image description here

can anyone please tell me what is the measuring unit(is it kb?) of 16987000 and 17092000? (i know they are the “sector start” and “sector end”, respectively.)

additionally, how do i know the measuring unit(mb?) of block size for specific partition(such as VMFS Datastore or Linux Swap, for example) when configuring with partedUtil in ESXi??

The last question is: do I need to multiply “block size” by “space I need” as the space(between start sector and end sector) for the partition I need? or maybe the space between start and end sector is quite simple to calculate which does not need to take “block size” into consideration?

thanks in advance!!

dual boot – Ubuntu deleting files on NTFS Partition automatically

I was cloning a repo but as shown as soon as it got cloned and i entered to open it in my ubuntu(20.04) it dissappeared, it has happened before once but i didn’t care as file was not important it only seems happens when i am cloning (yes only cloned repositories and couple of .mp4 got corrupted don’t know if videos are related to this) into my ntfs hdd which i share with windows (dual- boot) so i tried looking for it and i found my old folder that dissappeared in .trash-1000. but no sign of folder that got deleted today. Does it have something to do with partition being ntfs?
found more video file it has been deleting in found.000.

partition – Macbook Pro main volume not accessible – filesystem type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

Preface: I know there are lots of other questions about this on here, but they do not exactly match my situation and/or I do not have the technical knowledge to apply the answers to my situation. Thank you in advance for any help!

I have a Macbook Pro (Late 2011), running High Sierra. I partitioned the harddrive to install Linux. I later uninstalled Linux, and I seemingly did it in a bad way! My main volume now is unbootable, and it does not show up in the startup manager. I’m also not able to boot from Recovery, so to get to the terminal I’ve booted from a UBS flash drive with a MacOS installer on it.

I followed the steps from answers to similar questions on here, and I got to the step where I remove the volume with the gpt command, but then couldn’t get any further. So the main partition doesn’t show up on the diskutil list anymore (shown below).

Here is some relevant information from the terminal. Sorry for the awful alignment of these. If there’s a way to type is out in a more readable way here, I don’t know it. For convenience of viewing, I’ve also included photos of these outputs (below).

$ diskutil list

#: TYPE. NAME SIZE IDENTIFIER
0: GUID_partition_scheme – 750.2 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS – 650.0 MB disk0s3
3: Microsoft Basic Data – 74.3 GB disk0s4

gpt -r show disk0

gpt show: disk0: Suspicious MBR at sector 0
start size index contents
0 1 – MBR
1 1 – Pri GPT header
2 32 – Pri GPT table
34 6
40 409600 1 GPT part – C12A7328-F81F-BA4B-00A0C93EC93B
409640 1318255112 2 MBR part 218 (no contents because I removed this one)
1318664752 1269536 3 GPT part – 48465300-0000-11AA-AA11-00306543ECAC
1319934288 1712 – –
1319936000 145210938 4 GPT part – EBD0A0A2-B9E5-4433-B7C0-6886B72699C7
1465146938 2197 – –
1465149135 32 – Sec GPT table
1465149167 1 – Sec GPT header

output from diskutil list
output from got -r show disk0

The answer at this question has been the most helpful to me so far. However, I do not have an additional mac to do the hex dump that the answer calls for. If needed, I can borrow one from a friend, but I don’t own one.

Any help would be greatly appreciated!