## postgresql – Postgres SUM over PARTITION BY “tolerate” null values

I have a view which calculates rolling sum taking in value form previous row based on `PARTITION BY` clause, and I need to indicate one field Im using in PARTITION BY clause can have nulls in them.

``````sum(s."QuantityChange") OVER (PARTITION BY s."LocationId", s."PartId", s."SupplierFacilityId" ORDER BY s."DueDate" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "RunningSum"
``````

sometimes `SupplierFacilityId` is null and that’s fine, it should still be included in the sum() calculation.

Is this possible with Postgres?

## analysis – Entropy for partition with respect to sum of Dirac measures

Let $$(X,mathcal{A},m)$$ be some probability space where $$m=frac{1}{p}sum_{j=0}^{p-1}delta_{f^jx}$$ for some fixed $$xin X$$ that is $$p$$-periodic with respect to the measure-preserving transformation $$fcolon Xto X$$, i.e., $$f^p(x)=x$$. Here the $$delta_{T^jx}$$ is the Dirac-measure.

Now, let $$A={A_1,ldots,A_k}$$ be some finite measurable partition of $$X$$ and define
$$bigvee_{i=0}^{n}f^{-i}A:=left{bigcap_{i=0}^nf^{-i}A_{j_i}: A_{j_i}in Aright}.$$

I would like to verify that for the entropy $$h(f,A)$$ of $$f$$ with respect to $$A$$ one has $$h(f,A)=0$$.

To this end, one needs to argue that
$$h(f,A)=lim_{ntoinfty}frac{1}{n}Hleft(bigvee_{i=0}^{n}f^{-i}Aright)=0,$$
where $$Hleft(bigvee_{i=0}^{n}f^{-i}Aright)$$ is the entropy of the partition $$alpha_n:=bigvee_{i=0}^{n}f^{-i}A$$ which is defined as
$$H(alpha_n)=-sum_{alphainalpha_n}m(alpha)log m(alpha).$$

Here’s what I’ve tried so far:

Without loss of generality, we can assume that $$n>p$$. Due to the periodicity of $$x$$, we have
$$xin A_{j_0},quad fxin A_{j_1},quadldots,quad f^{p-1}xin A_{j_{p-1}},quad f^pxin A_{j_0},quad,f^{p+1}xin A_{j_1},quadldots$$
for some unique $$A_{j_i}in A, i=0,1,2,ldots$$.

Thus, for $$0leq ileq p-1$$,
$$delta_{f^ix}(alpha)=begin{cases}1, & alpha=A_{j_i}cap f^{-1}A_{j_{i+1}}capldotscap f^{-(p-1)}A_{j_{i+p-1}}cap f^{-p}A_{j_i}cap f^{-(p+1)}A_{j_{i+1}}capldotscap f^{-n}A_{j_{i+n}}\0, & textrm{otherwise}end{cases}$$

## lvm – Why does my partition table keep vanishing, on Debian?

I’m trying to make a 9gig partition for mongodb.

The disk doesn’t have a partition table, so I use fdisk and create one. Then I create a 40gig partition, and a 9gig partition.

I click ‘w’ to write changes, reboot and it’s all vanished.

I run `fdisk /dev/vga` and am informed that there’s no partition table. Needless to say, `fdisk -l` doesn’t show any partitions, either.

What am I doing wrong?

## hard drive – Macbook Disk contains swap partition with half my disk – How to reduce swap partition

hard drive – Macbook Disk contains swap partition with half my disk – How to reduce swap partition – Ask Different

## boot – My computer is not booting up after deleting Windows partition

I just turned on my TOSHIBA Satellite, when I noticed that my computer’s boot-up or start-up screen wasn’t showing up. I tried to guess and the first thing that hit me was that it may be some important partition which may have been responsible for the boot which I must have deleted. Is there a way to fix this? Maybe I can try changing the motherboard?

Note this is a TOSHIBA Satellite 7340/4730 I can’t remember.
OS I used to delete a partition : Linux Mint

## How to convert HFS+ partition to APFS on Mac?

After struggling with deleting Ubuntu from my Mac alongside with macOS, after deleting EFI volume it became free and unused. How can I convert it to APFS again and include that in my HD storage?

here is the screen.

Disk structure

## partitioning – “0 bytes free” after partition resizing, but there is much unused space

Using GParted, I resized two Ext4 partitions on my external HDD, making them smaller.

But now the OS says there is no space available on both of them.

This is the outptut of `df -H` for those partitions.

``````Filesystem    Size    Used    Avail    Use%
/dev/sdb5     782G    744G        0    100%
/dev/sdb6     635G    616G        0    100%
``````

The very output above makes no sense at all, how can it say there are 0 bytes available when almost 40 gigabytes are not used e.g. in `/dev/sdb5` ?

I tried executing both the following commands automatically via GParted
(I show them just for `/dev/sdb5` but I tried them on both partitions).

``````e2fsck -f -y -v -C 0 /dev/sdb5
resize2fs -p /dev/sdb5
``````

but nothing changed.

I can modify existing files in those two partitions, and in particular I can delete files , but even if I delete a big file the OS still says there are 0 bytes available.

What is going on here?

PS: It still says 0 bytes available even if I am root.

## linux – Root partition out of space side-effects

If your root partition runs out of space you can expect a system downtime. You’ll probably can SSH to it, but it would stop storing logs or even crash.

That’s why best practices say to split your disk into a few partitions.
Splitting it into /, /tmp, and /home is quite a standard, but, besides that, you’re supposed to create an additional partition for your services data.

i.e. If you’re installing a database server, create a /var/db or /data partition
If you’re installing a proxy server, create a /cache partition
I also like to create a /var partition in a way that logs wouldn’t fill out root partition as well.

This way, if your system runs out of space because your service just fills it out, it would be limited to the partition its storing data, and your server would keep up and running. Although it would still lead to a service outage, your server tends to keep being accessible and logging data.

## Resize filesystem on Windows boot partition using linux

I recently installed Windows and Arch linux on dual boot. I left 512MB of empty space for windows to create the boot partition in, but it only used 100MB. Now I need more space in the boot partition so I resized the partition using cfdisk, but as expected, that didn’t resize the file system.

The EFI boot partition (`/dev/sda2`) is formatted as fat32, as shown by parted.

``````\$ sudo parted /dev/sda2
(parted) print
Model: Unknown (unknown)
Disk /dev/sda2: 512MiB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start    End     Size    File system  Flags
1      0.00MiB  512MiB  512MiB  fat32
``````

But when I try to use fatresize, it complains about the partition format.

``````\$ sudo fatresize -s 512M /dev/sda2
fatresize 1.1.0 (20200405)
Error: /dev/sda2 is not valid FAT16/FAT32 partition.
``````

So how can I resize the file system? I would rather not have to reinstall windows.

## ubuntu 18.04 – Openstack: The ext4 file system creation in partition #1 of Virtual disk 1 (vda) failed

I followed the official devstack All-In-One Single Machine installation and after everything installed, when I create an instance with 1GB ram and 10 GB hard disk of ubuntu 18.04 desktop
the messenge show up “The ext4 file system creation in partition #1 of Virtual disk 1 (vda) failed”. My environment is 200 GB hard disk and 10 GB ram with 4 CPU. What is the problem and what should do? Thanks!